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