swift - Custom User Location Annotation Callout doesn't work -
i want change standard annotation callout view user location annotation in swift.
therefore created custom xib , custom class. in mapkit delegate load respective annotations. custom annotations appear every map annotation added expected not "current user location". here standard 1 being displayed still. how need change code standard 1 exchanged 1 below?
func mapview(mapview: mkmapview, viewforannotation annotation: mkannotation) -> mkannotationview? { var identifier = "" if (annotation mkuserlocation) { identifier = "userlocation" let annotationinfo:[string:anyobject] = ["featuretypeid": gisfeaturetype.annotationcurrentposition.rawvalue] if let userannotation = mapannotation(annotationinfo: annotationinfo) { userannotation.title = "aktueller standort" let annotationview = mapannotationview(annotation: userannotation, reuseidentifier: identifier) annotationview.canshowcallout = true return annotationview } } // annotation not user location guard let annotation = annotation as? mapannotation, let featuretypeid = annotation.featuretypeid else { return nil } identifier = "mapannotation" let annotationview = mapannotationview(annotation: annotation, reuseidentifier: identifier) switch (featuretypeid) { case .annotationincident: identifier = "mapannotationincidentdetailview" let detailview = uiview.loadfromnibnamed(identifier) as! mapannotationincidentdetailview detailview.incident = annotation.incident annotationview.detailcalloutaccessoryview = detailview case .annotationaed: identifier = "mapannotationaeddetailview" let detailview = uiview.loadfromnibnamed(identifier) as! mapannotationaeddetailview detailview.aed = annotation.aed annotationview.detailcalloutaccessoryview = detailview case .annotationcurrentposition: identifier = "mapannotationcurrentdetailview" let detailview = uiview.loadfromnibnamed(identifier) as! mapannotationcurrentdetailview annotationview.detailcalloutaccessoryview = detailview default: return nil } annotationview.canshowcallout = true return annotationview }
Comments
Post a Comment