iPhone location button

后端 未结 8 611
南方客
南方客 2021-02-05 23:28

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

8条回答
  •  时光取名叫无心
    2021-02-06 00:14

    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.

提交回复
热议问题