美文网首页
判断当前viewcontroller是push还是present

判断当前viewcontroller是push还是present

作者: 二先生Developer | 来源:发表于2018-02-23 23:15 被阅读67次
    NSArray *viewcontrollers = self.navigationController.viewControllers;
    if (viewcontrollers.count > 1) {
        if ([viewcontrollers objectAtIndex:viewcontrollers.count - 1] == self) { //push方式
            [self.navigationController popViewControllerAnimated:YES];
        }
    }
    else { //present方式
        [self.navigationController dismissViewControllerAnimated:YES completion:nil];
    }
    

    相关文章

      网友评论

          本文标题:判断当前viewcontroller是push还是present

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