Reputation: 5002
I am using a MKUserTrackingBarButtonItem
to toggle my MKMapView's usertrackingMode.
Thanks for your help.
Upvotes: 4
Views: 3098
Reputation: 54101
Starting in iOS 11, there's MKUserTrackingButton
which is a UIView
subclass.
Upvotes: 1
Reputation: 2441
So it seems there is no way to directly add any kind of bar button item to a UIView
. We're going to have to subclass UIToolbar
to make a totally invisible toolbar. Override - (void)drawRect:(CGRect)rect
and put nothing, not even a [super drawRect]
. Then, in init, run the following code:
self = [super init];
self.backgroundColor = [UIColor clearColor];
self.opaque = NO;
self.translucent = YES;
return self;
For more details, visit this link: Couldn't UIToolBar be transparent?
Upvotes: 5
Reputation: 2441
Here's a link so you can create an image out of the button. You probably want to do this as it enters multiple states:
Create UIImage from shadowed view while retaining alpha?
Upvotes: 0