美文网首页
iOS开发 生命周期

iOS开发 生命周期

作者: 喜剧收尾_XWX | 来源:发表于2021-03-04 21:47 被阅读0次

    一、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;
        }
    }
    

    相关文章

      网友评论

          本文标题:iOS开发 生命周期

          本文链接:https://www.haomeiwen.com/subject/ftclqltx.html