判断UIViewController是使用pop,dismiss

2018-08-11  本文已影响0人  tsiic

判断UIViewController是使用pop,dismiss返回到上级视图控制器

@(编程笔记)[iOS开发]

if self.navigationController?.topViewController == self, self.navigationController?.viewControllers.first != self {
    self.navigationController?.popViewController(animated: true)
} else {
    self.dismiss(animated: true, completion: nil)
}
上一篇 下一篇

猜你喜欢

热点阅读