我了解了当前的NSXMLParser.我阅读了很多教程,但没有人能告诉我它是如何工作的.StackOverflow上有一个教程?我的问题是我的应用程序中的KML读取结构,并使用MKMapView进行显示
我的Parser类看起来像:
#import <Foundation/Foundation.h>
@interface Parser : NSXMLParser
@property (nonatomic, strong) NSString *rowElementName; // this is the element name that identifies a new row of data in the XML
@property (nonatomic, strong) NSArray *attributeNames; // this is the array of attributes we might want to retrieve for that element name
@property (nonatomic, strong) NSArray *elementNames; // this is the list of sub element names for which we're retrieving values
@property (nonatomic, strong) NSMutableArray *items; // after parsing, this is the …Run Code Online (Sandbox Code Playgroud) 在以下方法中MKMapViewDelegate:
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "")
pinAnnotationView.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure)
pinAnnotationView.canShowCallout = true
return pinAnnotationView
}
Run Code Online (Sandbox Code Playgroud)
如果我像上面那样做,那么整个视图都是可点击的:
除此以外:
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "")
let accessoryView = UIButton(frame: CGRectMake(0, 0, 25, 25))
accessoryView.setImage(UIImage(named: "icon-menu"), forState: .Normal)
pinAnnotationView.rightCalloutAccessoryView = accessoryView
pinAnnotationView.canShowCallout = false
return pinAnnotationView
}
Run Code Online (Sandbox Code Playgroud)
只有右附件视图被点击,为什么?
问题是。怎么做才能使整体可点击
MKPinAnnotationView而不仅仅是正确的披露?
我想设置一个MKPointAnnotation,当它被点击时,我可以调用另一个功能.反正有没有添加手势识别器或类似的东西?
我需要用我的自定义注释视图替换默认注释视图.
我需要做以下事情:
有关更多说明,请参阅图像:

在上面的图像中,我需要在图像中以圆形形式显示白色空间中的图像视图,接下来我还需要添加一个包含标签的视图,我可以在其上设置任何文本,如我,朋友,等等...
所以,为此,我搜索了关于堆栈溢出的问题,但没有得到我的答案.我不希望它在呼出时,我只是想在渲染地图时将其简单地作为注释.我试图为此制作一个自定义类,但不知道如何处理这个.
任何帮助将受到高度赞赏