點擊展開按鈕從註釋後後顯示信息當前地圖的快照,你會最終有一個名爲查看信息。在此屏幕的左上角,有一個小圖像,它是您當前位置的快照。有誰知道如何從地圖和顯示信息畫面 獲取快照有這樣的圖像,讓您可以輕鬆地知道我在說什麼 請幫幫忙,所有的答案都在這裏歡迎。 如何點擊公開內容,從註釋
0
A
回答
0
你會想使用CoreGraphics中呈現地圖的圖像。
if (UIGraphicsBeginImageContextWithOptions != NULL) {
UIGraphicsBeginImageContextWithOptions(frameYouWantToCopy.size, NO, 0.0);
}
else {
UIGraphicsBeginImageContext(frameYouWantToCopy.size);
}
[mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result;
0
我已經得到了解決這一點 當你點擊信息按鈕剛剛設置地圖的中心。並從那裏拍攝圖像 我到目前爲止所做的是 在.h中拍攝了一個圖像mapImageview,並使用該imageview存儲了註釋的圖像 首先記住已丟棄的圖釘的座標 ,然後僅居中通過調用函數
-(void)setMaptocentre:(double)lat (double)long
{
MKCoordinateRegion region;
region.center.latitude=lat;
region.center.longitude=long;
MKCoordinateSpan span;
span.latitudeDelta=10;
span.longitudeDelta=10;
region.span =span;
[MapView setRegion:region animated:YES];
}
-(IBAction)infoPressed:(id)sender
{
[self setMaptocentre: rememberedLat rememberdLong];
//here the rememberedlat and rememberedLong are the latitude and longitude you have
// saved at the time of pin drop. the function brings the pin to centre of map
// and then does the following part to take the image, where it includes the pin
UIGraphicsBeginImageContext(CGRectMake(150, 200, 100, 100).size);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(c,-105, -130);
[self.view.layer renderInContext:c];
UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImagePNGRepresentation(viewImage);
mapImageview.image = [UIImage imageWithData:imageData];
}
我知道你會得到答案uptill,但現在他人的震動區域,我在這裏張貼 感謝
相關問題
- 1. 如何從PHP的註釋行內容
- 2. HTML註釋內容
- 3. MKMapView註釋點擊事件
- 4. AspectJ使用AspectJ註釋公開註釋值
- 5. 如何從python宏讀取LibreOffice作家註釋的內容
- 6. 打開右側內容點擊產品
- 7. 我可以公開註釋屬性嗎?
- 8. 如何更改點擊中的內容?
- 9. 如何找出點擊的內容?
- 10. Spring - 將文件內容從類路徑注入註釋成員
- 11. Swift Firebase在地圖註釋上下載註釋圖片點擊
- 12. 如何點擊內容編輯的DIV然後點擊期內保留焦點
- 13. 如何打開tr tr點擊內部tr點擊
- 14. 註釋框中點擊「贊」時消失
- 15. 上的註釋時,點擊推視圖
- 16. 使自定義註釋可點擊
- 17. 如何從單元格內容中找到行點擊?
- 18. Hibernate註釋。如何註釋?
- 19. LinkedIn API「公司關注」如何開始關注公司
- 20. IntelliJ Idea:如何在開發插件中公開類,接口和註釋
- 21. 如何檢測地圖上的點擊註釋Pin?
- 22. 如何獲得指數particlular註釋針的點擊在iphone
- 23. 如何調用按鈕上的引腳註釋點擊iphone
- 24. 如何獲得這些註釋的氣泡點擊
- 25. 無法更改/註釋的內容
- 26. 如何從js內部開始點擊或更改功能
- 27. 如何從按鈕打開.xib點擊
- 28. 如何從點擊RecyclerView開始活動
- 29. 點擊切換div內容
- 30. div內容不可點擊
感謝您的評論。現在處理它。 – tranvutuan 2012-02-16 19:05:39
我試過了,圖像的大小不太好。我所做的是** UIGraphicsBeginImageContextWithOptions(CGSizeMake(32,32),NO,0.0); ** – tranvutuan 2012-02-16 19:38:22
我試圖和圖像的大小不是處於良好shape.The長度爲兩倍的高度和它沒有顯示的註釋它......我所做的是* UIGraphicsBeginImageContextWithOptions(CGSizeMake(32,32),NO,0.0); * ...其餘的是從您的評論一樣。 – tranvutuan 2012-02-16 19:52:36