UISegmentedControl更改圆角

  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;

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0