0
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor];

Here i am setting the blue color for the rightbarbuttom item it works in ios5 but not in ios4. How should i prevent the crash so that my app supports both ios4 and ios5.

Kasaname
  • 1,491
  • 11
  • 15

2 Answers2

1

yes, @borrrden is correct, setting tintColor for UIBarButtonItem is available only after iOS 5.0. Check the condition before you set color to your navigationItem

#if __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
      self.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor];
#endif
arthankamal
  • 6,341
  • 4
  • 36
  • 51
  • you can found solution in this [link](http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/) or you have to create manual `UIButton` and can assign to your `UIBarButtonItem` like [here](http://stackoverflow.com/questions/664930/uibarbuttonitem-with-color) and you can assign that `UIBarButton` to your `rightBarButton` – arthankamal Dec 13 '12 at 10:14
0

You should stop using appearance and UIBarButtonItem's tintColor because they are not supported on iOS 4.x

borrrden
  • 33,256
  • 8
  • 74
  • 109