iphone ios7 segmented UISegmentedControl change only border color

后端 未结 6 1880
陌清茗
陌清茗 2020-12-29 13:47

Been looking around and trying to change just the border color (with a different text color) with no luck. Can change the tint, but changes both the text and border.

6条回答
  •  死守一世寂寞
    2020-12-29 14:06

    You can change first the tintColor and after the titleText.

    //Changes Tint Color
    segmentedControlName.tintColor = [UIColor colorWithRed:0/255 green:0/255 blue:0/255 alpha:1];
    
    //TitleText to BlackColor
    [[UISegmentedControl appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor blackColor] } forState:UIControlStateNormal];
    

提交回复
热议问题