30 JanHow to make locate me button like in Maps.app

It looks like we cannot make Locate Me button similar to original one from Maps.app. I mean an easy and with public API way. But there is a simple way to simulate it and make clear for users. Paste this snippet to xCode and connect several IBOutlets and IBActions.

IBOutlet UIBarButtonItem *findMeBarButton; IBOutlet UIBarButtonItem *activityBarButton;
- (void)showFinding{ if (!activityBarButton) {  UIView *customView = [[UIView alloc]
initWithFrame:CGRectMake(0, 0, 37, 30)];   UIActivityIndicatorView *actIndicator =
[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: 
UIActivityIndicatorViewStyleWhite];
[actIndicator startAnimating];  [actIndicator setCenter:customView.center];
[customView addSubview:actIndicator];   activityBarButton = [[UIBarButtonItem alloc]
initWithCustomView:customView][actIndicator release];  [customView release]; } 
[self.navigationItem setLeftBarButtonItem:activityBarButton animated:YES];} -
(void)hideFinding{ self.navigationItem.leftBarButtonItem = findMeBarButton;}
No comments

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment


* two = 8