iphone - UIBarButtonItem tintColor with UINavigationController -


i have navigation controller 2 uibarbuttonitems in navigation bar. want change tint color 1 on right. have found way in static that:

[[self.navigationcontroller.navigationbar.subviews objectatindex:2] settintcolor:[uicolor redcolor]]; 

the problem when push controller navigation controller display view, when come root view right navigation bar button supposed have custom color, color of button default. , when click again on it, app crashes. says cannot change tint color, if index element in navigation bar changed.

i have tried other technics found on internet, failed when use navigation controller , come root controller...

any idea? thanks!

edit 1:

i bordered style button in uinavigationbar, red or green background color.

regarding other ways found, pretty foreach loop of views in navigation bar, , if view's kind of class button item change tintcolor. doesn't crash applies uibarbuttonitem of navigation bar (and want specific button, right one, not of them). example this tutorial half working, app crashes when coming root view controller.

digging subviews of navigationcontroller.navigation bar wont fly apple, ...
correct way change color of uibarbuttonitem use customview buttonitem. here link explains...

uibarbuttonitem color?


Comments