UIViewController

public extension UIViewController
  • 将视图控制器推到接收器的堆栈上并更新显示

    Declaration

    Swift

    func pushVC(_ vc: UIViewController, animated: Bool = true)

    Parameters

    vc

    视图控制器

    animated

    是否有动画, 默认有

  • 从导航堆栈中弹出顶层视图控制器并更新显示

    Declaration

    Swift

    func popVC(animated: Bool = true)

    Parameters

    animated

    是否有动画, 默认有

  • 弹出堆栈上除根视图控制器之外的所有视图控制器并更新显示

    Declaration

    Swift

    func popToRoot(animated: Bool = true)

    Parameters

    animated

    是否有动画, 默认有

  • 以模态形式弹出视图

    Declaration

    Swift

    func presentVC(_ vc: UIViewController, animated: Bool = true, completion: NormalClosure? = nil)

    Parameters

    vc

    视图控制器

    animated

    是否有动画, 默认有

    completion

    闭包,默认空

  • 解除视图控制器以模式显示的视图控制器

    Declaration

    Swift

    func dismissVC(animated: Bool = true, completion: NormalClosure? = nil)

    Parameters

    animated

    是否有动画, 默认有

    completion

    闭包,默认空