Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望在远离当前 UIView 的任何转换上执行一些代码。视图本身可能会一直存在并且不会被垃圾收集,因此 viewDidUnload 可能不是合适的事件。
是否有其他事件或方法来检测给定视图何时不再显示?
-(void)viewWillDisappear:(BOOL)animated;或 -(void)viewDidDisappear:(BOOL)animated;取决于您要实现的业务逻辑
-(void)viewWillDisappear:(BOOL)animated;
-(void)viewDidDisappear:(BOOL)animated;