开发者

Getting a coordinate on an imageview

开发者 https://www.devze.com 2023-03-16 11:57 出处:网络
After searching for a way to drop a pin onto 开发者_开发技巧an imageview just like with mapview I\'ve come to conclusion that it\'s not possible. So I thought I can simulate a pin drop by creating mul

After searching for a way to drop a pin onto 开发者_开发技巧an imageview just like with mapview I've come to conclusion that it's not possible. So I thought I can simulate a pin drop by creating multiple imageviews, which will hold a png image of a standard pin, on the fly. Now, I want to create an imageview and place it just where the user taps.(Gesture type is not very important for now). I know I can get the touch coordinate. But what I need is not only this. I need to have those annotation pins in place any time I close and relaunch the app. So I think I'll have a plist with at least a dictinary that will hold a coordinate on the imageview as Key and callout or popview as Value. How do I place pre arranged pins on viewDidLoad method into the correct coordinates?Thanks ahead.


There could be two (may be more ) approaches.

1->you could use the NSUserDefault to save the setting and read them back in next launch .. 2->NSDictionary , which you have alreay mentioned.

To save your setting ...

NSDictionary *myDict = [[NSDictionary alloc] init];
// fill setting data in dictionary here 
.......................................
[[NSUserDefaults standardUserDefaults] setObject:myDict forKey:@"myMapDict"];
[[NSUserDefaults standardUserDefaults] synchronize];

To retrieve the application setting back

NSDictionary* myDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"myMapDict"]; 
0

精彩评论

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