我有一个类:classMyAnnotion:NSObject,MKAnnotation{lettitle:String?letsubtitle:String?letitem:MyCustomItemletcoordinate:CLLocationCoordinate2Dinit(customItem:MyCustomItem,currentLocation:CLLocation){coordinate=item.coordinatepageId="\(item.pageId)"title="\(item.title)"item=myCustomItem}//TODO:Eventhoug
我的map上有1个图钉。我需要将注释标题传递给另一个UIView(在这种情况下是ikinciEkran.swift)。但是我做不到。这是我的代码的segue部分,我不知道如何对所选注释的标题进行segue。我只贴了相关部分的代码。classMapViewController:UIViewController,CLLocationManagerDelegate,MKMapViewDelegate{@IBOutletweakvarmapView:MKMapView!@IBOutletweakvarlbl_Name:UILabel!@IBOutletweakvarlbl_Address:UI
我的swiftios应用程序中有一张map,上面全是标记。因此我决定使用从这里获取的标记聚类:https://github.com/ribl/FBAnnotationClusteringSwift在我的应用程序中实现它后,我看到了图钉和簇,这很酷。我是这样做的-首先我调用我的网络服务并获取每个引脚的所有数据并将其放入数组中:funcfetchRequests(radius:Double,lat:Double,lon:Double,completionHandler:(()->Void)?){Alamofire.request(.GET,"http://mywebservice.com/
我有一个TableView,用于在点击单元格时显示MapView注释标注。在iOS10中,我可以将MapView置于注释的中心,然后使用以下方法显示它的标注:functableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){letlocation=locations[indexPath.item]mapView.setCenter(location.coordinate,animated:true)mapView.selectAnnotation(location,animated:true)}locatio
我查看了其他关于子类化的堆栈溢出问题的代码和片段。我想要做的就是子类化MKAnnotation。我正在使用Xcode6.3。此代码适用于我friend的,但不适用于我的。我收到一个Type'Annotation'doesnotconformtoprotocol'MKAnnotation'错误importFoundationimportMapKitimportUIKitclassAnnotation:NSObject,MKAnnotation{varlocation:CLLocationCoordinate2Dvartitle:Stringvarsubtitle:Stringinit(l
我有一张map,其中添加了几个注释图钉。我想要实现的是,当其中一个引脚被轻敲时,引脚会变大。我有以下代码片段funcmapView(_mapView:MKMapView,didSelectview:MKAnnotationView){if(view.image!=nil){UIView.animate(withDuration:0.1){view.centerOffset=CGPoint(x:10,y:-20)view.frame.size=CGSize(width:(view.image?.size.width)!*2,height:(view.image?.size.height)
我不明白如何在Swift中更改标记点的图像。我已经尝试了的几种变体funcmapView(mapView:MKMapView!,viewForAnnotationannotation:MKAnnotation!)->MKAnnotationView!但它似乎永远不会被调用,我不知道如何强制调用它。我会说我也以编程方式添加了MKMapView,因此我可以根据正在使用的iPhone切换大小(水平和垂直)。(我仍然不敢相信这对Xcode来说不直观,程序员必须围绕它进行编程。)这是我的代码:@IBActionfuncaddStroke(sender:UIButton){NSLog("AddSt
在我的应用程序中,我有以下情况。我已经实现了一个带有自定义detailCalloutAccessoryView的自定义标注气泡,里面有两个标签。我知道如何使用此行更改detailCalloutAccessoryView的颜色。view.detailCalloutAccessoryView?.backgroundColor=UIColor.red但我不知道如何更改主气泡的背景颜色(现在是透明的灰色/白色)。使用view.detailCalloutAccessoryView?.backgroundColor=UIColor.red行我的calloutbubble看起来像这样:但我希望我的自
我有一个MapViewController用于在map上显示注释。它包含一个MapPresentable类型的对象。protocolMapPresentable{associatedtypeAnnotationElement:MKAnnotationvarannotations:[AnnotationElement]{get}}classMapViewController:UIViewController{varmapPresentable:M!}如果mapPresentable符合RoutePresentable协议(protocol),MapViewController也可以在ma
我有以下代码,旨在循环遍历当前苹果mapView上的所有注释并更新它们的位置坐标。forexistingMarkerinself.mapView.annotations{existingMarker.coordinate.latitude=12.12121212existingMarker.coordinate.longitude=14.312121121}很遗憾,这是不允许的。我被告知“坐标”是一个只能获取的属性。所以这显然不是我要更新已在mapView上绘制的注释的MKAnnotation位置的方式。那我该怎么做呢?具体来说,我想这样做并尽快用新坐标“重绘”map。我相信这一定是可