swift - Stop updating location when view (map) is not showing -
i have app map loaded after app starts. have views in app. i'd is, whene leave mapview, view, i'd map stop updating self location , than, start updating again self location, when come map view. (self location = user current location).
anyone can tell me how please?
thanks.
you can use locationm.stopupdatinglocation()
start updating location
override func viewdidappear(_ animated: bool) { super.viewdidappear(animated) locationm.startupdatinglocation() }
and stop
override func viewwilldisappear(_ animated: bool) { super.viewwilldisappear(animated) locationm.stopupdatinglocation() }
Comments
Post a Comment