MKUserTrackingBarButtonItem tint colour IOS7 does not work but does on IOS 6

940 Views Asked by At

Using XCode 5 targeting minimum OS of IOS6 I create the bar button item like this

self.navigationItem.rightBarButtonItem = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];

And then set its tint like this

self.navigationItem.rightBarButtonItem.tintColor = [UIColor colorWithRed:175.0f / 255.0f green: 189.0f / 255.0f blue: 69.0f / 255.0f alpha:1.0f];

When I deploy to an IOS6 devive the bar button item is correctly tinted, but on an IOS7 device it remains the stock blue

Is this an issue others have experienced? An XCode 5 bug?

Help?

Thanks

3

There are 3 best solutions below

0
On

I have not found a solution to this as well but I know changing your default window color will override it. If you don't mind your default window color being overridden you made the following to your app delegate's didFinishLaunchingWithOptions method.

self.window.tintColor = [UIColor colorWithRed:175.0f / 255.0f green: 189.0f / 255.0f blue: 69.0f / 255.0f alpha:1.0f];
1
On
MKUserTrackingBarButtonItem *buttonItem = [[MKUserTrackingBarButtonItem alloc]    initWithMapView:self.mapView];    
[buttonItem.customView setTintColor:[UIColor colorWithRed:175.0f / 255.0f green: 189.0f / 255.0f blue: 69.0f / 255.0f alpha:1.0f]];
1
On

From Apple Documentation :

In iOS 6, tintColor tinted the background of navigation bars, tab bars, toolbars,search bars, and scope bars. To tint a bar background in iOS 7, use the barTintColor property instead.

iOS 7 Transition Guide