extension UINavigationController {
/// 向前 push 跳转并移除当前页
/// - Parameter toVc: 跳转的页面
internal func pushAndRemoveCurrent(toVc: UIViewController) {
var newNavViews: Array<UIViewController> = []
for index in 0..<(viewControllers.count - 1) {
let vc: UIViewController = viewControllers[index]
newNavViews.append(vc)
}
newNavViews.append(toVc)
setViewControllers(newNavViews, animated: true)
}
}
网友评论