ios - how to create a custom callout button from each annotation view? -


im trying create button within each annotation view bring user new page custom selected annotation. i've implemented mapview show annotations titles , subtitles loaded parse database struggling find way of 1) adding button annotation view bring user new view 2) finding way of creating custom views each of annotations when selected. appreciated ?

code

class viewcontroller: uiviewcontroller, mkmapviewdelegate, cllocationmanagerdelegate {      @iboutlet weak var mapview: mkmapview!      var mapviewlocationmanager:cllocationmanager! = cllocationmanager()     let btn = uibutton(type: .detaildisclosure)       override func viewdidload() {         super.viewdidload()          mapview.showsuserlocation = true         mapview.delegate = self         mapviewlocationmanager.delegate = self         mapviewlocationmanager.startupdatinglocation()         mapview.setusertrackingmode(mkusertrackingmode.follow, animated: true)      }      override func viewdidappear(animated: bool) {         let annotationquery = pfquery(classname: "clubs")         annotationquery.findobjectsinbackgroundwithblock {             (clubs, error) -> void in             if error == nil {                 // find succeeded.                 print("successful query annotations")                 // found objects                 let myclubs = clubs! [pfobject]                 club in myclubs {                      //data annotation                     let annotation = mkpointannotation()                     let place = club["location"] as? pfgeopoint                     let clubname = club["clubname"] as? string                     let stadiumname = club["stadium"] as? string                     annotation.title = clubname                     annotation.subtitle = stadiumname                     annotation.coordinate = cllocationcoordinate2dmake(place!.latitude,place!.longitude)                      //add annotations                     self.mapview.addannotation(annotation)                 }               } else {                 // log details of failure                 print("error: \(error)")             }         }      } 

for 1st - can use leftcalloutaccessoryview & rightcalloutaccessoryview on annoationview. have implement mapviewdelegate mapview(_:viewforannotation:).

for 2nd - similar calloutaccessoryview, have access detailcalloutaccessoryview on annoationview. can use customize callout.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -