I'm adding the items programatically, but MKUserTrackingBarButtonItem doesn't seem to offer any way to style it to fit in with a BlackTranslucent UIToolBar...

enter image description here

有帮助吗?

解决方案

MKUserTrackingBarButtonItem is a subclass of UIBarButtonItem which has a tintColor property. You can use this to make your button black.

MKUserTrackingBarButtonItem *userTrackingBarButtonItem = 
        [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];

[self.navigationController.toolbar setBarStyle:UIBarStyleBlack];
[userTrackingBarButtonItem setTintColor:[UIColor blackColor]];

If you do set it to black like this, the user will never know when it's activated, as the blue color is never shown.

black button

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top