UISegmentedControl更改圆角

Wesley131117 阅读
文章目录
UISegmentedControl *segmentC = [[UISegmentedControl alloc]initWithItems:[NSArray arrayWithObjects:@"本周周报",@"历史周报", nil]];
segmentC.frame = CGRectMake(0,0, 120, 30);
segmentC.layer.borderColor = [UIColor whiteColor].CGColor;
segmentC.layer.borderWidth = 1;
segmentC.tintColor = [UIColor whiteColor];
segmentC.backgroundColor = [UIColor clearColor];
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName,[UIFont systemFontOfSize:14],NSFontAttributeName,nil];
[segmentC setTitleTextAttributes:dic forState:UIControlStateNormal];
segmentC.layer.cornerRadius = 15.0f;
segmentC.layer.masksToBounds = YES;
segmentC.tintColor = [UIColor whiteColor];
self.navigationItem.titleView = segmentC;
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册⭐️ Admin快速开发: https://show.cool-admin.com/
赞 0⭐️ 官方文档: https://cool-js.com
赞 0⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld
赞 0