美文网首页
UINavigationController.h

UINavigationController.h

作者: ShenYj | 来源:发表于2016-08-26 16:40 被阅读72次
    
    
    typedef NS_ENUM(NSInteger, UINavigationControllerOperation) {
        UINavigationControllerOperationNone,
        UINavigationControllerOperationPush,
        UINavigationControllerOperationPop,
    };
    
    UIKIT_EXTERN const CGFloat UINavigationControllerHideShowBarDuration;
    
    @class UIView, UINavigationBar, UINavigationItem, UIToolbar, UILayoutContainerView;
    @protocol UINavigationControllerDelegate;
    
    #pragma - mark - --
    NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationController : UIViewController
    
    // 可以添加 navigationBarClass 或其子类,toolbarClass 也是一样的。
    - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass NS_AVAILABLE_IOS(5_0);
    // 初始化根控制器
    - (id)initWithRootViewController:(UIViewController *)rootViewController;
    
    - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; // 推到下一个界面
    
    - (UIViewController *)popViewControllerAnimated:(BOOL)animated; // 返回上一个界面
    
    - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; // 返回到上几个界面,返回被推出的控制器的数组
    
    - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated; // 返回到根界面
    
    // 栈顶控制器
    @property(nonatomic,readonly,retain) UIViewController *topViewController;
    // 当前可见视图所属的控制器
    @property(nonatomic,readonly,retain) UIViewController *visibleViewController;
    // 所有的栈里地控制器
    @property(nonatomic,copy) NSArray *viewControllers;
    - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0);
    
    // 隐藏导航条
    @property(nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden;
    - (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated;
    @property(nonatomic,readonly) UINavigationBar *navigationBar;
    
    // 工具条
    @property(nonatomic,getter=isToolbarHidden) BOOL toolbarHidden NS_AVAILABLE_IOS(3_0);
    - (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated NS_AVAILABLE_IOS(3_0);
    @property(nonatomic,readonly) UIToolbar *toolbar NS_AVAILABLE_IOS(3_0);
    
    @property(nonatomic, assign) id<UINavigationControllerDelegate> delegate;
    @property(nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0);
    @end
    
    @protocol UIViewControllerInteractiveTransitioning;
    @protocol UIViewControllerAnimatedTransitioning;
    
    @protocol UINavigationControllerDelegate <NSObject>
    
    @optional
    // 将要显示某一个控制器
    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
    // 已经显示某一个控制器
    - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
    // 支持的旋转方向
    - (NSUInteger)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0);
    
    - (UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0);
    
    - (id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
                              interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController NS_AVAILABLE_IOS(7_0);
    
    - (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                       animationControllerForOperation:(UINavigationControllerOperation)operation
                                                    fromViewController:(UIViewController *)fromVC
                                                      toViewController:(UIViewController *)toVC  NS_AVAILABLE_IOS(7_0);
    
    @end
    
    @interface UIViewController (UINavigationControllerItem)
    // 导航条组件
    @property(nonatomic,readonly,retain) UINavigationItem *navigationItem;
    @property(nonatomic) BOOL hidesBottomBarWhenPushed;
    @property(nonatomic,readonly,retain) UINavigationController *navigationController;
    
    @end
    
    @interface UIViewController (UINavigationControllerContextualToolbarItems)
    
    @property (nonatomic, retain) NSArray *toolbarItems NS_AVAILABLE_IOS(3_0);
    - (void)setToolbarItems:(NSArray *)toolbarItems animated:(BOOL)animated NS_AVAILABLE_IOS(3_0);
    
    @end
    
    

    相关文章

      网友评论

          本文标题:UINavigationController.h

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