ios - UISegmentedControl tintColor -
i'm having problems getting uisegmentedcontrol show desired tint color.
// appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // need red tint color in other views of app [[uiview appearance] settintcolor:[uicolor redcolor]]; return yes; } // viewcontroller - (void)viewdidload { [super viewdidload]; nsarray *items = @[@"item 1", @"item 2"]; uisegmentedcontrol *control = [[uisegmentedcontrol alloc] initwithitems:items]; // have control have green tint color control.tintcolor = [uicolor greencolor]; [self.view addsubview:control]; }
how make uisegmentedcontrol use green tint color?
try ?
for (uiview *subview in mysegmentedcontrol.subviews) { [subview settintcolor: [uicolor greencolor]]; }
but appears known issue in ios 7, don't know if has been fixed in ios 8.
"you cannot customize segmented control’s style on ios 7. segmented controls have 1 style"
Comments
Post a Comment