ios - UISegmentedControl selected tintColor on viewLoad -


i attempting set tintcolor , selected tintcolor uisegmentedcontrol.

so far works fine except fact when view first loads, though call method set tintcolor (and executes) tintcolor doesnt set correctly until first click.

it appear however, if something happening because trying set color black white selection, , default colors tad darker.

any ideas on how modify colors load?

//some code -(void)viewdidload _segmentedcontrol.selectedsegmentindex = 0; [self segmentedcontrol:_segmentedcontrol]; 

//set color method - (ibaction)segmentedcontrol:(basesegmentedcontrol *)sender { //change color of every subview(segment) have  (int = 0; < [[sender subviews] count]; i++ ) {     if ([[sender.subviews objectatindex:i]isselected] )     {         [[sender.subviews objectatindex:i] settintcolor:nil];         [[sender.subviews objectatindex:i] settintcolor:[uicolor whitecolor]];     }     else     {         [[sender.subviews objectatindex:i] settintcolor:nil];         [[sender.subviews objectatindex:i] settintcolor:[uicolor blackcolor]];     } } 

thanks

i think you've put uisegmentedcontrol navigationbar. when this, uisegmentedcontrol loaded before view, setting tint color of no use. find solution here:

 self.segmentedcontroll.tintadjustmentmode = uiviewtintadjustmentmodenormal; 

as document says:

when property’s value changes (either view’s value changing or 1 of superview’s values changing), -the system calls tintcolordidchange method allow view refresh rendering.

adding line viewdidload method, cause segmentedcontroll redraw.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -