1 UISegmentedControl *segmentC = [[UISegmentedControl alloc]initWithItems:[NSArray arrayWithObjects:@"本周周报",@"历史周报", nil]]; 2 3 segmentC.frame = CGRectMake(0,0, 120, 30); 4 5 6 7 segmentC.layer.borderColor = [UIColor whiteColor].CGColor; 8 9 segmentC.layer.borderWidth = 1; 10 11 segmentC.tintColor = [UIColor whiteColor]; 12 13 segmentC.backgroundColor = [UIColor clearColor]; 14 15 16 17 NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName,[UIFont systemFontOfSize:14],NSFontAttributeName,nil]; 18 19 [segmentC setTitleTextAttributes:dic forState:UIControlStateNormal]; 20 21 segmentC.layer.cornerRadius = 15.0f; 22 23 segmentC.layer.masksToBounds = YES; 24 25 26 segmentC.tintColor = [UIColor whiteColor]; 27 28 self.navigationItem.titleView = segmentC;
UISegmentedControl更改圆角
Wesley13
2021-10-11
1039 1 0
点赞
收藏
评论区
加载中...