iOS——类似QQsegment切换按钮
2017-03-28 00:00
295 查看
UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"洗车订单",@"其他订单", nil]];
segment.layer.masksToBounds = YES;
segment.layer.cornerRadius = 15;
segment.layer.borderColor = HKWHITE.CGColor;
segment.layer.borderWidth = 1.0;
//设置默认选择项索引
segment.selectedSegmentIndex = 0;
segment.frame = CGRectMake(0, 5, 180, 30);
segment.tintColor = HKWHITE;
//文字设置
NSMutableDictionary *attDic = [NSMutableDictionary dictionary];
attDic[NSFontAttributeName] = HKFont(15);
NSMutableDictionary *attDicSelected = [NSMutableDictionary dictionary];
attDicSelected[NSFontAttributeName] = HKFont(17);
[segment setTitleTextAttributes:attDic forState:UIControlStateNormal];
[segment setTitleTextAttributes:attDicSelected forState:UIControlStateSelected];
[segment addTarget:self action:@selector(selectSegment:) forControlEvents:UIControlEventValueChanged];
self.navigationItem.titleView = segment;
segment.layer.masksToBounds = YES;
segment.layer.cornerRadius = 15;
segment.layer.borderColor = HKWHITE.CGColor;
segment.layer.borderWidth = 1.0;
//设置默认选择项索引
segment.selectedSegmentIndex = 0;
segment.frame = CGRectMake(0, 5, 180, 30);
segment.tintColor = HKWHITE;
//文字设置
NSMutableDictionary *attDic = [NSMutableDictionary dictionary];
attDic[NSFontAttributeName] = HKFont(15);
NSMutableDictionary *attDicSelected = [NSMutableDictionary dictionary];
attDicSelected[NSFontAttributeName] = HKFont(17);
[segment setTitleTextAttributes:attDic forState:UIControlStateNormal];
[segment setTitleTextAttributes:attDicSelected forState:UIControlStateSelected];
[segment addTarget:self action:@selector(selectSegment:) forControlEvents:UIControlEventValueChanged];
self.navigationItem.titleView = segment;
相关文章推荐
- iOS——类似QQsegment切换按钮
- 实现类似QQ聊天列表的segment点击切换tableView的数据功能
- IOS 实现边滑动边缩放的类似qq主界面的页面切换功能
- IOS 实现边滑动边缩放的类似qq主界面的页面切换功能
- iOS开发之实现图片自动切换(类似android画廊效果)
- iOS:手机横屏时,按下横屏视图上的导航条“返回”按钮后,切换为另一个竖屏视图
- unityios开发--NGUI类似QQ菜单实现
- [IOS视图切换]ViewDeck类似path效果的实现
- Android实现程序前后台切换效果(类似QQ后台运行)
- 两种方式实现类似qq搜索的切换
- iOS自定义类似导航的视图切换框架
- Android实现程序前后台切换效果(类似QQ后台运行)
- iOS_28仿QQ空间_控制器的切换_自定义segmentCtrol
- 类似QQ的左侧切换
- IOS开发之自定义segment实现视图切换
- IOS开发之UIButton同时设置图片文字以及触发按钮时文字图片的切换
- IOS开发之UIButton同时设置图片文字以及出发按钮时文字图片的切换
- IOS 入门开发之导航栏按钮切换
- winForm窗体关闭按钮实现托盘后台运行(类似QQ托盘区运行)
- iOS 用html创建带下划线的链接(类似下划线按钮的功能)