문제

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