0
Q
获取当前位置
A
回答
0
您需要设置delegate
方法,并添加此mapView.showsUserLocation = YES;
:
,然后加入这轻松设置缩放级别只复制MKMapView-ZoomLevel.h
和.m
:
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
[mapView setCenterCoordinate:userLocation.coordinate zoomLevel:20 animated:NO];
UIGraphicsBeginImageContextWithOptions(mapView.bounds.size, mapView.opaque, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
[mapView.layer renderInContext:context];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//save to Photo Album
UIImageWriteToSavedPhotosAlbum(UIImagePNGRepresentation(image), nil, nil, nil);
}
相关问题
- 1. Android获取当前位置
- 2. android获取当前位置
- 3. 获取当前位置android
- 4. 获取当前位置
- 5. 获取当前位置
- 6. 获取当前位置ImageView
- 7. 获取当前位置
- 8. CLLocation当前位置获取位置
- 9. blackberry gps获取当前位置地址?
- 10. 从react-router-redux获取当前位置
- 11. 使用CLLocationCoordinate2D获取当前位置
- 12. 在GPS中获取当前位置?
- 13. 在android中获取当前位置
- 14. 在当前位置获取标记
- 15. osmdroid获取当前用户位置
- 16. 获取当前鼠标位置
- 17. 获取谷歌地图当前位置
- 18. 如何获取当前的GPS位置?
- 19. Android - 可靠地获取当前位置
- 20. 如何获取当前位置android?
- 21. android获取当前位置失败
- 22. 获取当前GPS位置android studio
- 23. 使用json获取当前位置
- 24. 如何获取当前位置Gmaps V2 ..?
- 25. 从AppDelegate获取当前位置
- 26. 使用cordovaGeolocation获取当前位置
- 27. 获取访问者的当前位置
- 28. Viewpager:获取当前项目位置
- 29. 获取当前位置的问题
- 30. 无法获取当前位置坐标
如何拍摄这个快照。你可以给我一个示例代码 – user2434837
快照与UIGraphicsBeginImageContextWithOptions(mapView.bounds.size,mapView.opaque,0.0); CGContextRef context = UIGraphicsGetCurrentContext(); [mapView.layer renderInContext:context]; UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();你可以用图像做任何你想做的事情。 – soryngod
如果我不使用mapview,只需点击一个按钮,所有的事情都在背景下做,然后在imageview中显示一张照片? – user2434837