代码库> 分段选择> 垂直方向上的分段控件--SMVerticalSegmentedControl
垂直方向上的分段控件--SMVerticalSegmentedControl
关注
上传者:ccsupport 分类:分段选择(Segment)
查看次数:3360 下载次数:428
上传时间:2014-01-06 大小:165 B
SMVerticalSegmentedControl的设计灵感来自于HMSegementedControl,朴素简洁,不过它是垂直方向上的分段控件。使用ARC
测试环境:Xcode 5.0,iOS 7.0以上

示例代码:
Simple
NSArray *titles = @[@"Title 1", @"Title 2", @"Title 3", @"Title 4"];
SMVerticalSegmentedControl *segmentedControl = [[SMVerticalSegmentedControl alloc] initWithSectionTitles:titles];
[self.view addSubview:segmentedControl];

Advanced
NSArray *titles = @[@"Title 1", @"Title 2", @"Title 3", @"Title 4"];
SMVerticalSegmentedControl *segmentedControl = [[SMVerticalSegmentedControl alloc] initWithSectionTitles:titles];
segmentedControl.selectedSegmentIndex = 3;
segmentedControl.textColor = [UIColor grayColor];
segmentedControl.selectedTextColor = [UIColor blackColor];
segmentedControl.textAlignment = SMVerticalSegmentedControlTextAlignmentCenter;
segmentedControl.selectionStyle = SMVerticalSegmentedControlSelectionStyleBox;
segmentedControl.selectionIndicatorThickness = 0;
segmentedControl.selectionBoxBorderWidth = 2;
segmentedControl.selectionBoxBackgroundColorAlpha = 0.5;
segmentedControl.selectionBoxBorderColorAlpha = 0.7;
segmentedControl.indexChangeBlock = ^(NSInteger index) {
    //TODO: add handler
};
[self.view addSubview:segmentedControl];
  


收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部