Adding buttons to toolbar programmatically in swift

前端 未结 6 1571
天命终不由人
天命终不由人 2021-02-04 03:14

I\'m having a hard time adding a button to the toolbar in swift, below you can see an image of the toolbar that I\'m after, unfortunately even though I have it designed in my St

6条回答
  •  梦如初夏
    2021-02-04 03:37

    Here is an example with MKUserTrackingBarButtonItem:

    navigationController?.toolbarHidden = false
    let barButtonItem = MKUserTrackingBarButtonItem(mapView: self.mapView)
    self.toolbarItems = [barButtonItem]
    

提交回复
热议问题