#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIViewController.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UIInterface.h>
#import <UIKit/UIGeometry.h>
#import <UIKit/UIPanGestureRecognizer.h>
#import <UIKit/UITapGestureRecognizer.h>
/*!
UINavigationController manages a stack of view controllers and a navigation bar.
It performs horizontal view transitions for pushed and popped views while keeping the navigation bar in sync.
UINavigationController管理一堆視圖控制器和一個導航欄读慎。
它為push和pop視圖執(zhí)行水平視圖過渡唧龄,同時保持導航欄同步俐巴。
Most clients will not need to subclass UINavigationController.
大多數(shù)客戶端不需要子類UINavigationController憎妙。
If a navigation controller is nested in a tabbar controller, it uses the title and toolbar attributes of the bottom view controller on the stack.
如果導航控制器嵌套在tabbar控制器中,它將使用堆棧上底部視圖控制器的標題和工具欄屬性。
UINavigationController is rotatable if its top view controller is rotatable.
Navigation between controllers with non-uniform rotatability is currently not supported.
如果UINavigationController的頂視圖控制器是可旋轉(zhuǎn)的,則它是可旋轉(zhuǎn)的内贮。
目前不支持在具有不均勻可旋轉(zhuǎn)性的控制器之間導航。
*/
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, UINavigationControllerOperation) {
UINavigationControllerOperationNone,
UINavigationControllerOperationPush,
UINavigationControllerOperationPop,
};
UIKIT_EXTERN const CGFloat UINavigationControllerHideShowBarDuration;
@class UIView, UINavigationBar, UINavigationItem, UIToolbar;
@protocol UINavigationControllerDelegate;
NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationController : UIViewController
/* Use this initializer to make the navigation controller use your custom bar class.
Passing nil for navigationBarClass will get you UINavigationBar, nil for toolbarClass gets UIToolbar.
The arguments must otherwise be subclasses of the respective UIKit classes.
使用此初始化程序使導航控制器使用您的自定義欄類汞斧。
為navigationBarClass傳遞nil將獲得UINavigationBar夜郁,toolbarClass的nil獲取UIToolbar。
否則參數(shù)必須是相應UIKit類的子類
*/
- (instancetype)initWithNavigationBarClass:(nullable Class)navigationBarClass toolbarClass:(nullable Class)toolbarClass NS_AVAILABLE_IOS(5_0);
// 便捷方法在沒有動畫的情況下推動根視圖控制器粘勒。
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController; // Convenience method pushes the root view controller without animation.
// 使用水平幻燈片過渡竞端。 如果視圖控制器已在堆棧中,則無效庙睡。
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; // Uses a horizontal slide transition. Has no effect if the view controller is already in the stack.
// 返回彈出的控制器事富。
- (nullable UIViewController *)popViewControllerAnimated:(BOOL)animated; // Returns the popped controller.
// 彈出視圖控制器,直到指定的控制器位于頂部乘陪。 返回彈出的控制器统台。
- (nullable NSArray<__kindof UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; // Pops view controllers until the one specified is on top. Returns the popped controllers.
// 彈出,直到堆棧上只剩下一個視圖控制器暂刘。 返回彈出的控制器饺谬。
- (nullable NSArray<__kindof UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated; // Pops until there's only a single view controller left on the stack. Returns the popped controllers.
// 堆棧上的頂視圖控制器捂刺。
@property(nullable, nonatomic,readonly,strong) UIViewController *topViewController; // The top view controller on the stack.
// 返回模態(tài)視圖控制器(如果存在)谣拣。 否則頂視圖控制器募寨。
@property(nullable, nonatomic,readonly,strong) UIViewController *visibleViewController; // Return modal view controller if it exists. Otherwise the top view controller.
// 當前視圖控制器堆棧。
@property(nonatomic,copy) NSArray<__kindof UIViewController *> *viewControllers; // The current view controller stack.
// 如果動畫為YES森缠,則根據(jù)新的頂視圖控制器先前是否在堆棧中來模擬推送或彈出拔鹰。
- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); // If animated is YES, then simulate a push or pop depending on whether the new top view controller was previously in the stack.
// 隱藏或顯示導航欄。 如果是動畫贵涵,它將使用UINavigationControllerHideShowBarDuration垂直過渡列肢。
@property(nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden;
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated; // Hide or show the navigation bar. If animated, it will transition vertically using UINavigationControllerHideShowBarDuration.
// 導航欄由控制器管理。 不支持在托管導航欄上推送宾茂,彈出或設(shè)置導航項瓷马。
@property(nonatomic,readonly) UINavigationBar *navigationBar; // The navigation bar managed by the controller. Pushing, popping or setting navigation items on a managed navigation bar is not supported.
@property(nonatomic,getter=isToolbarHidden) BOOL toolbarHidden NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // Defaults to YES, i.e. hidden.
// 隱藏或顯示屏幕底部的工具欄。 如果是動畫跨晴,它將使用UINavigationControllerHideShowBarDuration垂直過渡欧聘。
- (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // Hide or show the toolbar at the bottom of the screen. If animated, it will transition vertically using UINavigationControllerHideShowBarDuration.
// 用于提交活動表時使用。
@property(null_resettable,nonatomic,readonly) UIToolbar *toolbar NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // For use when presenting an action sheet.
@property(nullable, nonatomic, weak) id<UINavigationControllerDelegate> delegate;
@property(nullable, nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;
// 解釋為pushViewController:animated:
- (void)showViewController:(UIViewController *)vc sender:(nullable id)sender NS_AVAILABLE_IOS(8_0); // Interpreted as pushViewController:animated:
// 鍵盤出現(xiàn)時端盆,將隱藏導航控制器導航欄工具欄怀骤。 當鍵盤解除時,導航欄將保持隱藏狀態(tài)焕妙,但點擊內(nèi)容區(qū)域?qū)@示它們蒋伦。
/// When the keyboard appears, the navigation controller's navigationBar toolbar will be hidden. The bars will remain hidden when the keyboard dismisses, but a tap in the content area will show them.
@property (nonatomic, readwrite, assign) BOOL hidesBarsWhenKeyboardAppears NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
// 當用戶滑動時,導航控制器導航欄和工具欄將被隱藏(在向上滑動時)或顯示(在向下滑動時)焚鹊。 只有具有項目的工具欄才會參與痕届。
/// When the user swipes, the navigation controller's navigationBar & toolbar will be hidden (on a swipe up) or shown (on a swipe down). The toolbar only participates if it has items.
@property (nonatomic, readwrite, assign) BOOL hidesBarsOnSwipe NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
// 如果導航欄由于滑動而隱藏或顯示,則觸發(fā)手勢識別器末患。 請勿更改委托或嘗試通過重寫此方法來替換此手勢爷抓。
/// The gesture recognizer that triggers if the bars will hide or show due to a swipe. Do not change the delegate or attempt to replace this gesture by overriding this method.
@property (nonatomic, readonly, strong) UIPanGestureRecognizer *barHideOnSwipeGestureRecognizer NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
// 當UINavigationController的垂直大小類是緊湊的時,隱藏UINavigationBar和UIToolbar阻塑。 通常被這些條占據(jù)的區(qū)域中未處理的水龍頭將顯示條形
/// When the UINavigationController's vertical size class is compact, hide the UINavigationBar and UIToolbar. Unhandled taps in the regions that would normally be occupied by these bars will reveal the bars.
@property (nonatomic, readwrite, assign) BOOL hidesBarsWhenVerticallyCompact NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
/// When the user taps, the navigation controller's navigationBar & toolbar will be hidden or shown, depending on the hidden state of the navigationBar. The toolbar will only be shown if it has items to display.
// 當用戶點擊時蓝撇,導航控制器的navigationBar和工具欄將被隱藏或顯示,具體取決于navigationBar的隱藏狀態(tài)陈莽。 只有具有要顯示的項目時才會顯示工具欄渤昌。
@property (nonatomic, readwrite, assign) BOOL hidesBarsOnTap NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
/// The gesture recognizer used to recognize if the bars will hide or show due to a tap in content. Do not change the delegate or attempt to replace this gesture by overriding this method.
// 手勢識別器用于識別由于內(nèi)容中的點擊而使導航欄隱藏或顯示。 請勿更改委托或嘗試通過重寫此方法來替換此手勢走搁。
@property (nonatomic, readonly, assign) UITapGestureRecognizer *barHideOnTapGestureRecognizer NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
@end
@protocol UIViewControllerInteractiveTransitioning;
@protocol UIViewControllerAnimatedTransitioning;
@protocol UINavigationControllerDelegate <NSObject>
@optional
// Called when the navigation controller shows a new top view controller via a push, pop or setting of the view controller stack.
// 當導航控制器通過視圖控制器堆棧的push独柑,pop或setting顯示新的頂視圖控制器時調(diào)用。
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;
- (UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController NS_AVAILABLE_IOS(7_0);
- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
animationControllerForOperation:(UINavigationControllerOperation)operation
fromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC NS_AVAILABLE_IOS(7_0);
@end
@interface UIViewController (UINavigationControllerItem)
// 按需創(chuàng)建私植,以便視圖控制器可以自定義其導航外觀忌栅。
@property(nonatomic,readonly,strong) UINavigationItem *navigationItem; // Created on-demand so that a view controller may customize its navigation appearance.
// 如果是,則當此視圖控制器被推入具有底欄的控制器層次結(jié)構(gòu)(如標簽欄)時曲稼,底欄將滑出索绪。 默認為NO湖员。
@property(nonatomic) BOOL hidesBottomBarWhenPushed __TVOS_PROHIBITED; // If YES, then when this view controller is pushed into a controller hierarchy with a bottom bar (like a tab bar), the bottom bar will slide out. Default is NO.
// 如果此視圖控制器已被推送到導航控制器,請將其返回瑞驱。
@property(nullable, nonatomic,readonly,strong) UINavigationController *navigationController; // If this view controller has been pushed onto a navigation controller, return it.
@end
@interface UIViewController (UINavigationControllerContextualToolbarItems)
@property (nullable, nonatomic, strong) NSArray<__kindof UIBarButtonItem *> *toolbarItems NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;
- (void)setToolbarItems:(nullable NSArray<UIBarButtonItem *> *)toolbarItems animated:(BOOL)animated NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;
@end
UINavigationController
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門怜瞒,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人般哼,你說我怎么就攤上這事吴汪。” “怎么了蒸眠?”我有些...
- 文/不壞的土叔 我叫張陵漾橙,是天一觀的道長。 經(jīng)常有香客問我楞卡,道長霜运,這世上最難降的妖魔是什么? 我笑而不...
- 正文 為了忘掉前任蒋腮,我火速辦了婚禮淘捡,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘池摧。我一直安慰自己焦除,他們只是感情好,可當我...
- 文/花漫 我一把揭開白布作彤。 她就那樣靜靜地躺著膘魄,像睡著了一般。 火紅的嫁衣襯著肌膚如雪竭讳。 梳的紋絲不亂的頭發(fā)上创葡,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼荸百!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起滨攻,我...
- 正文 年R本政府宣布,位于F島的核電站蚓挤,受9級特大地震影響磺送,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜灿意,卻給世界環(huán)境...
- 文/蒙蒙 一估灿、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧缤剧,春花似錦馅袁、人聲如沸。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至兄纺,卻和暖如春大溜,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背估脆。 一陣腳步聲響...