Map button refresh location

前端 未结 3 2056
清酒与你
清酒与你 2021-01-02 23:06

I am working on my first swift application for the iPad. Thus far I have a basic mapview with a button in the bottom toolbar, which I would like to refresh and focus onto th

3条回答
  •  粉色の甜心
    2021-01-02 23:48

    Try the following 3 line code:

    @IBAction func refresh(sender: AnyObject) {
        mapView.setCenterCoordinate(mapView.userLocation.coordinate, animated: true)
    }
    

    EDIT

    Check the following:

    Can you see the dot on the left side of the method?

    I want see your connections inspector. Refresh button and refresh method are connected correctly?

提交回复
热议问题