从A 页面推出一个B页面的生命周期,以及从B页面pop回A页面的生命周期

声明连个VC A、B

App启动,显示页面A

2022-09-30 18:47:06.876852+0800 test11[690:109238] A view will appear
2022-09-30 18:47:06.887673+0800 test11[690:109238] A view did appear

点击A 按钮 跳转B页面

2022-09-30 18:48:53.424909+0800 test11[695:109929]  B  view did Load
2022-09-30 18:48:53.425239+0800 test11[695:109929] A view will disappear
2022-09-30 18:48:53.425410+0800 test11[695:109929] B view will appear
2022-09-30 18:48:54.027319+0800 test11[695:109929] A view did disappear
2022-09-30 18:48:54.027908+0800 test11[695:109929] B view did appear

接下来的点击返回按钮 从B退出A页面:

2022-09-30 18:50:38.779772+0800 test11[695:109929] B view will disappear
2022-09-30 18:50:38.780187+0800 test11[695:109929] A view will appear
2022-09-30 18:50:39.294824+0800 test11[695:109929] B view did disappear
2022-09-30 18:50:39.295331+0800 test11[695:109929] A view did appear
2022-09-30 18:50:39.295724+0800 test11[695:109929] B dealloc

如果从B右滑返回,滑动到一半松手,仍显示B,会走哪些方法?

开始右滑B

2022-09-30 18:52:26.109155+0800 test11[695:109929] B view will disappear
2022-09-30 18:52:26.109546+0800 test11[695:109929] A view will appear

松手返回B

2022-09-30 18:52:34.168683+0800 test11[695:109929] A view will disappear
2022-09-30 18:52:34.169035+0800 test11[695:109929] A view did disappear
2022-09-30 18:52:34.169190+0800 test11[695:109929] B view will appear
2022-09-30 18:52:34.169294+0800 test11[695:109929] B view did appear

结合上一篇的NSTimer的释放应该手动放到哪里?
是不是放到

- (void)viewDidDisappear:(BOOL)animated{
    NSLog(@"view did disappear");
    [self.timer invalidate];
}

更多合适

你可能感兴趣的:(从A 页面推出一个B页面的生命周期,以及从B页面pop回A页面的生命周期)