views:

1411

answers:

6

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 but came up blank.

I'd prefer to use a system image or a system something-or-other, to help ensure consistency with other system functions.

A: 

I wouldn't be so sure that it's a system image. Many images/buttons in Apple's applications are specific to that application only, and this one looks to be that way.

James Skidmore
+1  A: 

I created my own image, and Apple accepted it (in contrast of using the search image for zooming purposes).

drvdijk
+1  A: 

http://glyphish.com/ icon library has location button available.

Simo Salminen
+1  A: 

(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"];
KennyTM
A: 
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.

Diallo
A: 

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.

esad