Ya know the little location button in the lower-left corner of the Maps application? Does anybody know where I can find that? I looked in UIButtonType and UITabBarSystemItem b
You can try using MKUserTrackingBarButtonItem It provides the same functionality as the track button on the Map app. Here is some same code.
MKUserTrackingBarButtonItem *trackButton = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];
NSMutableArray *items = [[NSMutableArray alloc] initWithArray:self.bottomToolbar.items];
[items insertObject:trackButton atIndex:0];
[self.bottomToolbar setItems:items];
UIImage* img = [UIImage kitImageNamed:@"UIButtonBarLocate.png"];
// Get the location of the Documents directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ;
NSString *imagePath = [paths objectAtIndex:0] ;
NSString *filename = @"test.png" ;
NSString *filepath = [NSString stringWithFormat:@"%@/%@", imagePath, filename] ;
// Save the image
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(img)];
[imageData writeToFile:filepath atomically:YES];
use this sample of code to save it as a file that you'll be able to use in your project!
Hope this help.
http://glyphish.com/ icon library has location button available.
Have a look at https://github.com/myell0w/MTLocation
I mimiced Google Maps' Locate Me - Button, including 4 different states and the animation that is done when switching between states.
Please note that in 4.0, the appearance of the "locate me" button in Maps.app button has changed. Further on, +[UIimage kitImageNamed:]
is gone, and calling -[UIBarbuttonItem initWithBarButtonSystemItem:]
with undocumented identifier 100 will return old-style graphics.
(Warning: undocumented feature, will be rejected by AppStore, blah blah blah)
The location button can be accessed with
UIBarButtonItem* item = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:100
target:... action:...];
If you just want the image, save the result returned by
UIImage* img = [UIImage kitImageNamed:@"UIButtonBarLocate.png"];