iOS 页面消失需要做处理的时候

2018-06-27  本文已影响34人  一只帅气的猿
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    NSArray *viewControllers = self.navigationController.viewControllers;//获取当前的视图控制其
    if ([viewControllers indexOfObject:self] == NSNotFound) {
        //当前视图控制器不在栈中,故为pop操作
        UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
        UIButton *button = [window viewWithTag:180];
        [button removeFromSuperview];
    }
    
}
上一篇下一篇

猜你喜欢

热点阅读