iOS开发 生命周期

2021-03-04  本文已影响0人  喜剧收尾_XWX

一、A ->B

2021-03-04 21:24:50.055729+0800 ObjcGo[1155:21068] B-----[BViewController loadView]
2021-03-04 21:24:50.055868+0800 ObjcGo[1155:21068] B-----[BViewController viewDidLoad]
2021-03-04 21:24:50.055976+0800 ObjcGo[1155:21068] A-----[AViewController viewWillDisappear:]
2021-03-04 21:24:50.056051+0800 ObjcGo[1155:21068] B------[BViewController viewWillAppear:]
2021-03-04 21:24:50.566897+0800 ObjcGo[1155:21068] A-----[AViewController viewDidDisappear:]
2021-03-04 21:24:50.567291+0800 ObjcGo[1155:21068] B------[BViewController viewDidAppear:]

二、B->A

2021-03-04 21:33:10.603306+0800 ObjcGo[1155:21068] B------[BViewController viewWillDisappear:]
2021-03-04 21:33:10.603458+0800 ObjcGo[1155:21068] A-----[AViewController viewWillAppear:]
2021-03-04 21:33:11.114892+0800 ObjcGo[1155:21068] B------[BViewController viewDidDisappear:]
2021-03-04 21:33:11.115148+0800 ObjcGo[1155:21068] A-----[AViewController viewDidAppear:]
2021-03-04 21:33:11.115352+0800 ObjcGo[1155:21068] B------[BViewController dealloc]

三、B->A->B

2021-03-04 21:43:00.092314+0800 ObjcGo[11544:914464] B------[BViewController viewWillDisappear:]
2021-03-04 21:43:00.092633+0800 ObjcGo[11544:914464] A-----[AViewController viewWillAppear:]
2021-03-04 21:43:01.409616+0800 ObjcGo[11544:914464] A-----[AViewController viewWillDisappear:]
2021-03-04 21:43:01.409853+0800 ObjcGo[11544:914464] A-----[AViewController viewDidDisappear:]
2021-03-04 21:43:01.409977+0800 ObjcGo[11544:914464] B------[BViewController viewWillAppear:]
2021-03-04 21:43:01.410058+0800 ObjcGo[11544:914464] B------[BViewController viewDidAppear:]

四、禁用滑动手势

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    NSLog(@"B-----%s",__func__);
    //禁用滑动手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    NSLog(@"B-----%s",__func__);
    
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}
上一篇下一篇

猜你喜欢

热点阅读