Tag: mkannotationview

停留在Swift和MapKit中使用MKPinAnnotationView()

我有一个工作循环来设置一些工作数据点的标题和字幕元素的注释。 我想在同一个循环结构中做的是将引脚颜色设置为紫色而不是默认值。 我无法弄清楚是我需要做什么来挖掘我的地图视图相应地设置引脚。 我的工作循环和一些尝试… …. for var index = 0; index < MySupplierData.count; ++index { // Establish an Annotation myAnnotation = MKPointAnnotation(); … establish the coordinate,title, subtitle properties – this all works self.theMapView.addAnnotation(myAnnotation) // this works great. // In thinking about PinView and how to set it up I have this… myPinView = MKPinAnnotationView(); myPinView.animatesDrop […]

了解iOS中的NSXMLParser

我学习了当前的NSXMLParser。 我读了很多教程,但没有人能告诉我它是如何工作的。 有一个关于StackOverflow的教程? 我的问题是这个KML读取结构在我的应用程序,并显示与MKMapView 我的parsing器类看起来像: #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, […]

mkannotation视图中的button操作不起作用?

你好,我卡在地图上的一个情况,我已经设法显示自定义注释。 当点击注释时,我必须显示一些信息和一个button的视图。 当用户点击button时,应该显示一个警报。 代码如下 – (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { if (![view.annotation isKindOfClass:[MKUserLocation class]]) { POCustomAnnotation *annotation = (POCustomAnnotation *)[view annotation]; UIView *bgview=[[UIView alloc]initWithFrame:CGRectMake(-30, -150,130, 150)]; bgview.backgroundColor=[UIColor grayColor]; UILabel *templbl=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 130, 120)]; templbl.text=annotation.displayText; templbl.textAlignment=NSTextAlignmentRight; templbl.numberOfLines=10; [bgview addSubview:templbl]; UIButton *tembtn=[UIButton buttonWithType:UIButtonTypeCustom]; [tembtn setTitle:@"More info" forState:UIControlStateNormal]; [tembtn addTarget:self action:@selector(annotationBtnAction:) forControlEvents:UIControlEventTouchUpInside]; tembtn.backgroundColor=[UIColor grayColor]; tembtn.frame=CGRectMake(0, 121, 130, […]

如何创build自定义MKAnnotationView和自定义注释标题和副标题

我需要在MKMapView上创build上面的Annotation视图。 我能够创build自定义注释视图,但在注释点击视图需要用大文本打开图像,我无法创build一个。 请给我提供一些链接或完成此任务的方法。

如何识别哪个引脚被窃听

我在这张地图上有一个MKMapView和大量的针脚的应用程序。 每个引脚都得到了rightCalloutAccessoryView 。 我以这种方式创build它: UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView.rightCalloutAccessoryView = rightButton; 我应该怎么知道,哪个针被窃听? 日Thnx

迅速不同的图像注释

我设法在Swift中获得了一个注释引脚的自定义图标,但是现在我仍然使用2个不同的图像来注释不同的注释。 现在一个button添加一个注释到地图。 应该有另一个button,也添加注释,但与另一个图标。 有没有办法使用这个重用ID? class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var Map: MKMapView! @IBAction func btpressed(sender: AnyObject) { var lat:CLLocationDegrees = 40.748708 var long:CLLocationDegrees = -73.985643 var latDelta:CLLocationDegrees = 0.01 var longDelta:CLLocationDegrees = 0.01 var span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, longDelta) var location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(lat, long) var region:MKCoordinateRegion = MKCoordinateRegionMake(location, span) Map.setRegion(region, animated: true) var information […]