touch event in iphone map view
In my project, 开发者_运维知识库i have to drop a pin (Annotation) on any touchable location in the map view by tapping that location and then add some text to the annotation. Is it possible to do so? If yes please describe..
Please review the Map Kit documentation and sample code. You should get familiar with the basic concepts in the SDK. Stack Overflow is an amazing community ready to help with specific problems but not really here to do your coding for you.
You should review this method:
- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view
as well as the standard ways of getting touch events for UIViews and the UIResponder superclass in general. This might be a good place to focus on:
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
http://developer.apple.com/iphone/library/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009541
Finally work on understanding of how to add annotations which is extensively documented and demonstrated in sample code. Infact there's a whole great section 'Annotating Maps' in here:
http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/LocationAwarenessPG/Introduction/Introduction.html
精彩评论