设置UISegmentControl的文字属性
2016-06-26 18:41
309 查看
以下代码可以设置UISegmentControl的文字属性。
UISegmentedControl *segmentedControl =.................;
segmentedControl.layer.cornerRadius = 20;
segmentedControl.clipsToBounds = YES;
segmentedControl.tintColor =[UIColor redColor]; //设置颜色
NSDictionary* selectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:12],
NSForegroundColorAttributeName: [UIColor whiteColor]};
[segmentedControl setTitleTextAttributes:selectedTextAttributes forState:UIControlStateSelected];//设置文字属性
NSDictionary* unselectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:12],
NSForegroundColorAttributeName: [UIColor redColor]};
[segmentedControl setTitleTextAttributes:unselectedTextAttributes forState:UIControlStateNormal];
UISegmentedControl *segmentedControl =.................;
segmentedControl.layer.cornerRadius = 20;
segmentedControl.clipsToBounds = YES;
segmentedControl.tintColor =[UIColor redColor]; //设置颜色
NSDictionary* selectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:12],
NSForegroundColorAttributeName: [UIColor whiteColor]};
[segmentedControl setTitleTextAttributes:selectedTextAttributes forState:UIControlStateSelected];//设置文字属性
NSDictionary* unselectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:12],
NSForegroundColorAttributeName: [UIColor redColor]};
[segmentedControl setTitleTextAttributes:unselectedTextAttributes forState:UIControlStateNormal];
相关文章推荐
- easyui datagrid列使用按钮
- 如何去除UITableView多余的空Cell
- IOS Dev Intro - Create UImage from Sample Buffer Data
- UISegmentController
- -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITab
- ${pageContext.request.contextPath}的作用
- 357. Count Numbers with Unique Digits
- UE4的类前缀
- STL之deque
- Bluebird-Core API (三)
- Arduino连接超声波传感器测距
- Bluebird-Core API(二)
- Druid 驱动海量实时多维分析
- soapui笔记10:测试流程控制
- Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools
- java中String、StringBuffer、StringBuilder的区别
- UISearchBar
- bluebird-Core API(一)
- STL之容器适配器
- soapui笔记9:断言4