interface builder - Setting the tintColor for 2 buttons in an iPhone app Nav-Bar -


I created a UI navigation in the IB but there is no way to set the button color ... so I code I do this with:

for (id subview of navBar.subviews) if ([SubView is KindOfClass: [UIButton class]]) {UIBarButtonItem * b = (UIBarButtonItem *) Subview; If ([b.title isEqualToString: @ "cancel"]) [b setintl: [UIColor redColor]]; If ([b.title isEqualToString: @ "Save"]) [B Settin: [UIColor greenColor]]; }

This appears to be working ... but about 2 warnings does not respond to the set int.

Is there a better (and completely legal) way to do this

< P> This is the way to do it legally.

if (foo) b.tintColor = [UIColor colorWithRed: 0.83 green: 0.43 blue: 0.57 alpha: 0.5];

Hope it helps I have helped you by clicking on it as the right answer so that we know that it actually worked for you And it will be a reference point for others because you can help confirm that it works for you.

If you need more help, then tell me PK


Comments