码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 自定义分段选择器

时间:2015-08-10 01:39:14      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

UIFont *titleFont = [UIFont systemFontOfSize:13];

// 状态1 

TKSegementedItemStatus *compositeNormal = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor blackColor] titleFont:titleFont image:nil backgroundImage:nil becomeCurrentStatusBlock:^{
        NSLog(@"综合默认状态");
    }];

 

// 状态2

TKSegementedItemStatus *compositeSelected = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor redColor] titleFont:titleFont image:nil backgroundImage:nil becomeCurrentStatusBlock:^{
        NSLog(@"综合刚刚被选中");
    }];

 

// 状态3

TKSegementedItemStatus *compositeOthers = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor green] titleFont:titleFont image:nil backgroundImage:image3 becomeCurrentStatusBlock:^{
        NSLog(@"价格降序状态");
    }];

 

TKSegementedItem *compositeItem = [TKSegementedItem itemWithNormalStatus:compositeNormal selectedStatus:compositeSelected otherStatus:compositeOthers];

TKSegementedView *segementedView = [TKSegementedView segementedViewWithSegementedItem:compositeItem, volumeItem, priceItem, filterItem, nil];

 

segementedView.frame = CGRectMake(0, 64, self.view.bounds.size.width, 35);

segementedView.verticalDividerInset = UIEdgeInsetsMake(10, 0, 10, 0);

[self.view addSubview:segementedView];

 

https://github.com/tomatoK/TKSegementedView

iOS 自定义分段选择器

标签:

原文地址:http://www.cnblogs.com/oumygade/p/4716801.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!