iOS 需要在viewWillDisappear执行的操作

2021-11-18  本文已影响0人  iOS程序媛ing

需要在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"];
上一篇 下一篇

猜你喜欢

热点阅读