开发者

iPhone SDK, adding annotations to mapview through a 2nd thread, need to refresh mapview

开发者 https://www.devze.com 2023-03-28 20:42 出处:网络
Im writing an iphone app that needs to display annotations depending on groups like \"Petrol Stati开发者_开发问答ons\",\"Restaurant\" as user selects. I\'m using MBProgressHUD and adding annotations i

Im writing an iphone app that needs to display annotations depending on groups like "Petrol Stati开发者_开发问答ons","Restaurant" as user selects. I'm using MBProgressHUD and adding annotations is done in background by a 2nd thread everytime user clicks on a choice. The problem is the new annotations aren't displayed on the screen until I move the map around. Is there anyway to kind of "refresh" or "wake" the mapView to display new annotations immediately after I add them from another thread ? Thanks


Edit: You can create a method that adds the annotations to the mapView after you calculated the coordinates in the background you call.

[controller performSelectorOnMainThread:@selector(addingMethod) withObject:annotation waitUntilDone:NO]
0

精彩评论

暂无评论...
验证码 换一张
取 消