iOS 需要在viewWillDisappear执行的操作

需要在viewWillDisappear执行的操作
(1)移除通知

[self.contentScrollView removeObserver:self forKeyPath:@"contentOffset"];

(2)移除观察者

[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];

(3)销毁timer

[self.timer invalidate];
self.timer = nil;

(4)停止定位

 [self.locationManager stopUpdatingLocation];

(5)webview移除注册的js方法

 [self.webView.configuration.userContentController removeScriptMessageHandlerForName:@"locateAction"];

你可能感兴趣的:(iOS 需要在viewWillDisappear执行的操作)