/*
UIViewController is a generic controller base class that manages a view.? It has methods that are called
when a view appears or disappears.
Subclasses can override -loadView to create their custom view hierarchy, or specify a nib name to be loaded
automatically.? This class is also a good place for delegate & datasource methods, and other controller
stuff.
*/
@classUIView;
//1. UIViewController是管理一個view的最基本的基類,當(dāng)一個view要顯示或者消失的時候,UIViewController有相應(yīng)方法會被調(diào)用。子類可以重寫loadView方法去創(chuàng)建他們自定義的view,或者指定一個nib被自動加載實現(xiàn)。這個類也是對于代理,數(shù)據(jù)源協(xié)議方法和一些其他控制器的方法展示實現(xiàn)一個很好的空間地方。
@classUINavigationItem, UIBarButtonItem, UITabBarItem;
//2. UINavigationItem是放置在導(dǎo)航欄中的,包含.rightBarButtonItem,.leftBarButtonItem,titleView,而這三個按鈕又可以歸為UIBarButtonItem類,并通過它創(chuàng)建。UITabBarItem是分欄控制器底部切換item按鈕。
@classUISearchDisplayController
//3. UISearchDisplayController是專門為UITableView搜索封裝的一個類。
@classUIPopoverController;
//4.UIPopverController是IPad特有的類,不能在iphone上使用,它負(fù)責(zé)控制Popover視圖。Popover是一種臨時視圖,它以“漂浮”的形式出現(xiàn)在視圖里面。
@classUIStoryboard, UIStoryboardSegue;
//5. UIStoryboard是iOS5以后新增的內(nèi)容,是以故事版的形式來展示界面之間的邏輯業(yè)務(wù)關(guān)系,前端開發(fā)目前有三種方式(純代碼,代碼+xib,UIStoryboard),UIStoryboard為其中一種。而UIStoryboardSegue—————————————————————
@classUIScrollView
//6. UIScrollView在UIKit中是UIScrollView類,是容器類型的視圖。它有三個子類—UITextView,UITableview和UICollectionView,它們在內(nèi)容超出屏幕時提供水平或垂直滾動條。
@protocolUIViewControllerTransitionCoordinator;
//7.這就涉及到自定義viewController容器轉(zhuǎn)場,iOS7引入的新特性自定義viewController轉(zhuǎn)場。-----------
typedefNS_ENUM(NSInteger, UIModalTransitionStyle) {
UIModalTransitionStyleCoverVertical =0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurlNS_ENUM_AVAILABLE_IOS(3_2),
};
//8.UIModalTransitionStyle是彈出模態(tài)ViewController時的四種動畫風(fēng)格,UIModalTransitionStyleCoverVertical是從底部滑入,UIModalTransitionStyleFlipHorizontal是水平翻轉(zhuǎn),UIModalTransitionStyleCrossDissolve是交叉溶解,UIModalTransitionStylePartialCurl是翻頁效果。
typedefNS_ENUM(NSInteger, UIModalPresentationStyle) {
UIModalPresentationFullScreen =0,
UIModalPresentationPageSheetNS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationFormSheetNS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationCurrentContextNS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationCustomNS_ENUM_AVAILABLE_IOS(7_0),
UIModalPresentationOverFullScreenNS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationOverCurrentContextNS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationPopoverNS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationNoneNS_ENUM_AVAILABLE_IOS(7_0) = -1,
};
//9,UIModalPresentationStyle是彈出模態(tài)ViewController時彈出風(fēng)格,UIModalPresentationFullScreen是彈出VC時,VC充滿全屏,UIModalPresentationPageSheet是如果設(shè)備橫屏,VC的顯示方式則從橫屏下方開始,UIModalPresentationFormSheet是VC顯示都是從底部,寬度和屏幕寬度一樣。UIModalPresentationCurrentContext是VC的彈出方式和VC父VC的彈出方式相同。.....UIModalPresentationNone測試時會崩潰,出錯'The specified modal presentation style doesn't have a corresponding presentation controller.'-------------------------------
@protocolUIContentContainer
//10.iOS8之后,加入了新的一組協(xié)議,UIViewController對這組協(xié)議提供了默認(rèn)的實現(xiàn),我們自定義ViewConttroller的時候可以重寫這些方法來調(diào)整視圖布局。
@property(nonatomic, readonly) CGSize preferredContentSizeNS_AVAILABLE_IOS(8_0);
//11.我們可以使用preferredContentSize來設(shè)置我們期望的childViewController的界面的大小。
- (void)preferredContentSizeDidChangeForChildContentContainer:(id)containerNS_AVAILABLE_IOS(8_0);
//12.這個方法告訴當(dāng)前容器viewController,我們可以在這個方法里根據(jù)新的size對界面進(jìn)行調(diào)整。
/*
Intended as a bridge for a view controller that does not use auto layout presenting a child that does use auto layout.
If the child's view is using auto layout and the -systemLayoutSizeFittingSize: of the view
changes, -systemLayoutFittingSizeDidChangeForChildContentContainer: will be sent to the view controller's parent.
*/
- (void)systemLayoutFittingSizeDidChangeForChildContentContainer:(id)containerNS_AVAILABLE_IOS(8_0);
//13.重寫方法來調(diào)整視圖布局,當(dāng)在這些情況下該方法會被調(diào)用,當(dāng)前viewController沒有使用auto layout布局,childrenViewController的view使用了autoLayout布局childrenViewController View-systemLayoutSizeFittingSize:方法返回的值的改變(view由于內(nèi)容的改變,size也出現(xiàn)了變化)
/*
When the content container forwards
viewWillTransitionToSize:withTransitionCoordinator: to its children, it
will call this method to determine what size to send them.
If the returned size is the same as the child container's current
size, viewWillTransitionToSize:withTransitionCoordinator: will not be
called.
*/
- (CGSize)sizeForChildContentContainer:(id)container withParentContainerSize:(CGSize)parentSizeNS_AVAILABLE_IOS(8_0);
//14.同上,依舊因為iOS8上size class概念的提出,UIViewConteroller支持了UIConntentContainer這樣一組新的協(xié)議,重寫這些方法可以調(diào)整視圖布局,一個容器viewController可以使用這個方法設(shè)置childViewController的size,當(dāng)容器viewControllerViewWillTransitionTosize:withTransitionCoordinator:被調(diào)用時(我們重寫這個方法時要調(diào)用super),sizeForChildContentContainer方法將被調(diào)用。然后我們可以把需要設(shè)置desire發(fā)送給childViewController。當(dāng)我們設(shè)置的這個size和當(dāng)前childViewController的size一樣,那么childViewController的viewWillTransitionToSize方法將不會被調(diào)用。sizeForChildContentContainer默認(rèn)的實現(xiàn)是返回parentSize
/*
This method is called when the view controller's view's size is
changed by its parent (i.e. for the root view controller when its window
rotates or is resized).
If you override this method, you should either call super to
propagate the change to children or manually forward the change to
children.
*/
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinatorNS_AVAILABLE_IOS(8_0);
//15.viewController的view的size被他的parentController改變時,會觸發(fā)這個方法(比如rootViewController在它的window旋轉(zhuǎn)的時候)我們重寫這個方法時,確保要調(diào)用super來保證size改變的這條消息能夠正常傳遞給它的views活著childViewControllers。
/*
This method is called when the view controller's trait collection is changed by its parent.
If you override this method, you should either call super to
propagate the change to children or manually forward the change to
children.
*/
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id)coordinatorNS_AVAILABLE_IOS(8_0);
//17.當(dāng)viewController的traitCollection的值將要改變時會調(diào)用這個方法,這個方法是在UITraitEnvironment協(xié)議方法traitCollectionDidChange:之前被調(diào)用。我們在重寫這個方法時候也要確保要調(diào)用super來保證消息的傳遞。比如,我們可以像這樣在traintCollection值改變時,對試圖做相應(yīng)的動畫進(jìn)行調(diào)整。
@end
// Sometimes view controllers that are using showViewController:sender and showDetailViewController:sender: will need to know when the split view controller environment above it has changed. This notification will be posted when that happens (for example, when a split view controller is collapsing or expanding). The NSNotification's object will be the view controller that caused the change.
UIKIT_EXTERNNSString *constUIViewControllerShowDetailTargetDidChangeNotificationNS_AVAILABLE_IOS(8_0);
//18.
NS_CLASS_AVAILABLE_IOS(2_0)@interfaceUIViewController : UIResponder {
//19.UIViewController繼承自UIResponder類,并實現(xiàn)NSCoding(實現(xiàn)歸檔操作),UIAppearanceContainer(允許開發(fā)者對UI控件通過定制都可以呈現(xiàn)各種外觀),UITraitEnvironment(SizeClasses適配理念,通過內(nèi)部的traitCollection屬性,可以拿到對應(yīng)的UITraitCollection對象,從而得知當(dāng)前的SizeClass,進(jìn)一步確定界面的布局),UIContentContainer協(xié)議(調(diào)整視圖布局)
@package
//20.實例變量范圍類型@package,對于framework內(nèi)部相當(dāng)于@protect,對于framework外部相當(dāng)于@private。
UIView ? ? ? ? ? *_view;
//21.view成員變量
UITabBarItem ? ? *_tabBarItem;
//22.分欄控制器的item按鈕成員變量
UINavigationItem *_navigationItem;
//23.導(dǎo)航欄item成員變量
NSArray? ? ? ? ? *_toolbarItems;
//24.數(shù)組用來保存工具條按鈕item的成員變量
NSString ? ? ? ? *_title;
//25.標(biāo)題title成員變量
NSString ? ? ? ? *_nibName;
//26.nib名稱成員變量
NSBundle ? ? ? ? *_nibBundle;
//27.bundle成員變量
UIViewController *_parentViewController;// Nonretained
//28.取父viewConreoller成員變量
UIViewController *_childModalViewController;
//29.取子模態(tài)ViewController成員變量
UIViewController *_parentModalViewController;// Nonretained
//30.取父模態(tài)ViewController成員變量
UIViewController *_previousRootViewController;// Nonretained
//31.取上一個根previous的成員變量
UIView ? ? ? ? ? *_modalTransitionView;
//32.模態(tài)過渡view的成員變量
UIResponder*_modalPreservedFirstResponder;
//33.第一個保存Responder成員變量
id_dimmingView;
//34.變暗的view-----------
id_dropShadowView;
//35.刪除陰影view成員變量--------------
id_currentAction;
//36.當(dāng)前動作方法
UIStoryboard ? ? *_storyboard;
//37.storyboard成員變量
NSArray? ? ? ? ? *_storyboardSegueTemplates;
//38.存放storyboardSegue的數(shù)組
NSDictionary ? ? *_externalObjectsTableForViewLoading;
//39.--------------------
NSArray? ? ? ? ? *_topLevelObjectsToKeepAliveFromStoryboard;
//40.--------------------
UIView ? ? ? ? ? *_savedHeaderSuperview;
//41.表頭的父view
UIView ? ? ? ? ? *_savedFooterSuperview;
//42.表尾的父view
UIBarButtonItem? *_editButtonItem;
//43.可編輯的BarButtonItem
UISearchDisplayController *_searchDisplayController;
//44.用于搜索的viewController
UIModalTransitionStyle _modalTransitionStyle;
//45.模態(tài)視圖過渡動畫樣式
UIModalPresentationStyle _modalPresentationStyle;
//46.模態(tài)視圖呈現(xiàn)樣式
UIInterfaceOrientation _lastKnownInterfaceOrientation;
//47.當(dāng)前程序界面的旋轉(zhuǎn)方向
UIPopoverController*? ? _popoverController;
//48.IPad專用的一種臨時視圖,以漂浮的形式出現(xiàn)在屏幕表面。
UIView *_containerViewInSheet;
//49.---------------
CGSize _contentSizeForViewInPopover;
//50.在IPad臨時視圖中展示容納的view大小
CGSize _formSheetSize;
//51.---------
UIScrollView *_recordedContentScrollView;
//52.-----------
void(^_afterAppearance)(void);
//53.---------------
NSInteger _explicitAppearanceTransitionLevel;
//54.------------
NSArray *_keyCommands;
//55.------------
NSMapTable *_overrideTraitCollections;
//56.--------了解過還是不太理解
/*
The designated initializer. If you subclass UIViewController, you must call the super implementation of this
method, even if you aren't using a NIB.? (As a convenience, the default init method will do this for you,
and specify nil for both of this methods arguments.) In the specified NIB, the File's Owner proxy should
have its class set to your view controller subclass, with the view outlet connected to the main view. If you
invoke this method with a nil nib name, then this class' -loadView method will attempt to load a NIB whose
name is the same as your view controller's class. If no such NIB in fact exists then you must either call
-setView: before -view is invoked, or override the -loadView method to set up your views programatically.
*/
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
//100.這個方法是加載對應(yīng)nibName的viewController
@property(nonatomic,retain) UIView *view;// The getter first invokes [self loadView] if the view hasn't been set yet. Subclasses must call super if they override the setter or getter.
//101.view屬性,如果當(dāng)你第一次調(diào)用[self loadView]方法而view還沒有被設(shè)置,子類必須要調(diào)用super父類方法重寫覆蓋setter和getter
- (void)loadView;// This is where subclasses should create their custom view hierarchy if they aren't using a nib. Should never be called directly.
//102.在loadView方法內(nèi)部可以創(chuàng)建自定義的view,有一前提是沒有使用xib。還有這個方法絕對不能直接主動去調(diào)用。
- (void)viewWillUnloadNS_DEPRECATED_IOS(5_0,6_0);
//103.view將要銷毀的時候會調(diào)用這個方法(不過現(xiàn)在已棄用)
- (void)viewDidUnloadNS_DEPRECATED_IOS(3_0,6_0);// Called after the view controller's view is released and set to nil. For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
//104.view已經(jīng)被銷毀的時候會調(diào)用這個方法(現(xiàn)在也已棄用)
- (void)viewDidLoad;// Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set.
//105.這個方法在view加載完畢的時候調(diào)用,在此方法內(nèi)部對view做一些渲染的事情,做一些初始化的操作,并且執(zhí)行順序是在loadView方法調(diào)用之后調(diào)用,
- (BOOL)isViewLoadedNS_AVAILABLE_IOS(3_0);
//106.判斷view是否被加載完畢
@property(nonatomic, readonly, copy) NSString *nibName;// The name of the nib to be loaded to instantiate the view.
//107.nibName作為屬性,加載對應(yīng)的nib。
@property(nonatomic, readonly, retain) NSBundle *nibBundle;// The bundle from which to load the nib.
//108.bundle是一個資源目錄,包含nib文件,nibBunlde作為屬性
@property(nonatomic, readonly, retain) UIStoryboard *storyboardNS_AVAILABLE_IOS(5_0);
//109.storyboard屬性,iOS5出現(xiàn)
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)senderNS_AVAILABLE_IOS(5_0);
//110.使用stortboard時利用segue進(jìn)行頁面跳轉(zhuǎn)的方法
- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)senderNS_AVAILABLE_IOS(6_0);// Invoked immediately prior to initiating a segue. Return NO to prevent the segue from firing. The default implementation returns YES. This method is not invoked when -performSegueWithIdentifier:sender: is used.
//111.這份方法是決定是否執(zhí)行segeue的關(guān)鍵。可在內(nèi)部做一些時間判斷,返回yes,將執(zhí)行performSegueWithIdentifier:方法,返回no不執(zhí)行performSegueWithIdentifier:,默認(rèn)返回yes,可以執(zhí)行
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)senderNS_AVAILABLE_IOS(5_0);
//112.當(dāng)用storyboard并且觸發(fā)segue時,系統(tǒng)會自動調(diào)用這個方法,可以重寫這個方法,在內(nèi)部做一些類與類傳遞數(shù)據(jù)的操作
// View controllers will receive this message during segue unwinding. The default implementation returns the result of -respondsToSelector: - controllers can override this to perform any ancillary checks, if necessary.
- (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)senderNS_AVAILABLE_IOS(6_0);
//113.我們一般在子控制器中通過實現(xiàn)canperformUnwindSegueAction:fromViewController:withSender:來決定要不要執(zhí)行相應(yīng)的Unwind Segue。
// Custom containers should override this method and search their children for an action handler (using -canPerformUnwindSegueAction:fromViewController:sender:). If a handler is found, the controller should return it. Otherwise, the result of invoking super's implementation should be returned.
- (UIViewController *)viewControllerForUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)senderNS_AVAILABLE_IOS(6_0);
//114.這個方法用來決定哪個viewController來處理Unwind Segue action
// Custom container view controllers should override this method and return segue instances that will perform the navigation portion of segue unwinding.
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifierNS_AVAILABLE_IOS(6_0);
//115.這個方法用來返回自定義的Unwind Segue實例
- (void)viewWillAppear:(BOOL)animated;// Called when the view is about to made visible. Default does nothing
//116.這個方法是當(dāng)view將要顯示的時候被調(diào)用
- (void)viewDidAppear:(BOOL)animated;// Called when the view has been fully transitioned onto the screen. Default does nothing
//117.這個方法是當(dāng)view已經(jīng)顯示的時候被調(diào)用
- (void)viewWillDisappear:(BOOL)animated;// Called when the view is dismissed, covered or otherwise hidden. Default does nothing
//118.這個方法是當(dāng)view將要消失的時候調(diào)用
- (void)viewDidDisappear:(BOOL)animated;// Called after the view was dismissed, covered or otherwise hidden. Default does nothing
//119.這個方法是當(dāng)view已經(jīng)消失的時候調(diào)用
// Called just before the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
- (void)viewWillLayoutSubviewsNS_AVAILABLE_IOS(5_0);
//120.在重新布局子view前的時候會調(diào)用
// Called just after the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
- (void)viewDidLayoutSubviewsNS_AVAILABLE_IOS(5_0);
//120.在重新布局子view后的時候會調(diào)用
@property(nonatomic,copy) NSString *title;// Localized title for use by a parent controller.
//121.標(biāo)題title屬性
- (void)didReceiveMemoryWarning;// Called when the parent application receives a memory warning. On iOS 6.0 it will no longer clear the view by default.
//122.當(dāng)應(yīng)用程序收到內(nèi)存警告的時候會調(diào)用這個方法,做相應(yīng)的解決內(nèi)存警告的操作
/*
If this view controller is a child of a containing view controller (e.g. a navigation controller or tab bar
controller,) this is the containing view controller.? Note that as of 5.0 this no longer will return the
presenting view controller.
*/
@property(nonatomic,readonly) UIViewController *parentViewController;
//123.取父viewController的屬性
// This property has been replaced by presentedViewController.
@property(nonatomic,readonly) UIViewController *modalViewControllerNS_DEPRECATED_IOS(2_0,6_0);
//124.得到模態(tài)視圖控制器
// The view controller that was presented by this view controller or its nearest ancestor.
@property(nonatomic,readonly) UIViewController *presentedViewControllerNS_AVAILABLE_IOS(5_0);
//125.------------------------
// The view controller that presented this view controller (or its farthest ancestor.)
@property(nonatomic,readonly) UIViewController *presentingViewControllerNS_AVAILABLE_IOS(5_0);
//126.正在展示的控制器
/*
Determines which parent view controller's view should be presented over for presentations of type
UIModalPresentationCurrentContext.? If no ancestor view controller has this flag set, then the presenter
will be the root view controller.
*/
@property(nonatomic,assign)BOOLdefinesPresentationContextNS_AVAILABLE_IOS(5_0);
//127.決定哪個父viewController的view應(yīng)當(dāng)呈現(xiàn)在當(dāng)前,如果沒有父viewController,呈現(xiàn)的將是根視圖控制器。
// A controller that defines the presentation context can also specify the modal transition style if this property is true.
@property(nonatomic,assign)BOOLprovidesPresentationContextTransitionStyleNS_AVAILABLE_IOS(5_0);
//128.如果這個屬性是true的話,可以定義模態(tài)過渡轉(zhuǎn)場的樣式
/*
These four methods can be used in a view controller's appearance callbacks to determine if it is being
presented, dismissed, or added or removed as a child view controller. For example, a view controller can
check if it is disappearing because it was dismissed or popped by asking itself in its viewWillDisappear:
method by checking the expression ([self isBeingDismissed] || [self isMovingFromParentViewController]).
*/
- (BOOL)isBeingPresentedNS_AVAILABLE_IOS(5_0);
//129.判斷viewController是否正在展示
- (BOOL)isBeingDismissedNS_AVAILABLE_IOS(5_0);
//130.判斷viewController是否正在消失
- (BOOL)isMovingToParentViewControllerNS_AVAILABLE_IOS(5_0);
//131.判斷是否正在向父viewController移動
- (BOOL)isMovingFromParentViewControllerNS_AVAILABLE_IOS(5_0);
//132.判斷是否正由父viewController移動而來
/*
The next two methods are replacements for presentModalViewController:animated and
dismissModalViewControllerAnimated: The completion handler, if provided, will be invoked after the presented
controllers viewDidAppear: callback is invoked.
*/
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void(^)(void))completionNS_AVAILABLE_IOS(5_0);
//133.這個方法可以實現(xiàn)從當(dāng)前viewController模態(tài)跳轉(zhuǎn)到另一個viewController,completion可在viewDidAppear后回調(diào)
// The completion handler, if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked.
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void(^)(void))completionNS_AVAILABLE_IOS(5_0);
//134.這個方法可以實現(xiàn)退出當(dāng)前viewController由模態(tài)方式展現(xiàn)出來的,completion可在viewDidDisappear后回調(diào)
// Display another view controller as a modal child. Uses a vertical sheet transition if animated.This method has been replaced by presentViewController:animated:completion:
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animatedNS_DEPRECATED_IOS(2_0,6_0);
//135.呈現(xiàn)模態(tài)視圖
// Dismiss the current modal child. Uses a vertical sheet transition if animated. This method has been replaced by dismissViewControllerAnimated:completion:
- (void)dismissModalViewControllerAnimated:(BOOL)animatedNS_DEPRECATED_IOS(2_0,6_0);
//136.退出模態(tài)視圖
/*
Defines the transition style that will be used for this view controller when it is presented modally. Set
this property on the view controller to be presented, not the presenter.? Defaults to
UIModalTransitionStyleCoverVertical.
*/
@property(nonatomic,assign) UIModalTransitionStyle modalTransitionStyleNS_AVAILABLE_IOS(3_0);
//137.當(dāng)一個viewController以模態(tài)方式呈現(xiàn)的時候,通過modalTransitionStyle可設(shè)置過渡動畫樣式
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyleNS_AVAILABLE_IOS(3_2);
//137.當(dāng)一個viewController以模態(tài)方式呈現(xiàn)的時候,通過modalPresentationStyle可設(shè)置呈現(xiàn)的樣式
// This controls whether this view controller takes over control of the status bar's appearance when presented non-full screen on another view controller. Defaults to NO.
@property(nonatomic,assign)BOOLmodalPresentationCapturesStatusBarAppearanceNS_AVAILABLE_IOS(7_0);
//138.這個屬性是控制是否顯示狀態(tài)欄
// Presentation modes may keep the keyboard visible when not required. Default implementation affects UIModalPresentationFormSheet visibility.
- (BOOL)disablesAutomaticKeyboardDismissalNS_AVAILABLE_IOS(4_3);
//139.這個API是于關(guān)閉鍵盤相關(guān)的,通常情況下單純的使用resignFirstResponder即可關(guān)閉鍵盤,但是在UIModalPresentationFormSheet下的視圖是無法用resignFirstResponder這個API,是因為在進(jìn)入到此模式后,系統(tǒng)將disablesAutomaticKeyboardDismissal的方法返回值設(shè)置成了YES,所以解決方法很簡單,重新實現(xiàn)disablesAutomaticKeyboardDismissal,如果是直接使用viewController則可以在實現(xiàn)文件中重新實現(xiàn)這個API,將返回改為NO后,即可正常使用resignFirstResponder方法隱藏鍵盤,但很多時候我們是把viewController放在UINavigationController中的,這種情況下直接在viewController這里面實現(xiàn)disablesAutomaticKeyboardDismissal依然失效,而應(yīng)發(fā)iUINavigationController中實現(xiàn)這個API。
@property(nonatomic,assign)BOOLwantsFullScreenLayoutNS_DEPRECATED_IOS(3_0,7_0);// Deprecated in 7_0, Replaced by the following:
//140.wantsFullScreenLayout=true,狀態(tài)欄的高度就不會被算在視圖里,也就是說有沒有狀態(tài)欄y坐標(biāo)始終都是從0算起(不過此屬性在iOS7已被棄用,下面屬性替代此功能)
@property(nonatomic,assign) UIRectEdge edgesForExtendedLayoutNS_AVAILABLE_IOS(7_0);// Defaults to UIRectEdgeAll
//141.iOS7的新屬性,默認(rèn)值為UIRectEdgeAll,在navigationController中view的默認(rèn)布局從navigationBar開始,self.edgesForExtendedLayout=UIRectEdgeNone,則布局控件減去navigationBar----------------
@property(nonatomic,assign)BOOLextendedLayoutIncludesOpaqueBarsNS_AVAILABLE_IOS(7_0);// Defaults to NO, but bars are translucent(透明的,半透明的)by default on 7_0.
//142.在iOS7中UIViewController的wantsFullScreenLayout已經(jīng)被舍棄,不在提供控件自動展示到導(dǎo)航欄下面這個屬性,所有的UIViewController創(chuàng)建后默認(rèn)就是full
Screen的,因此如果帶導(dǎo)航欄的應(yīng)用界面中的部分控件會被導(dǎo)航欄覆蓋掉,要解決這個情況可以使用iOS7中UIVIewController新增的屬性extendedLayoutIncludesOpaqueBars和edgesForExtendedLayout來解決。其中這個屬性指定了當(dāng)bar使用了不透明圖片時,視圖是否眼神至bar所在區(qū)域,默認(rèn)值是NO,而edgesForExtendedLayout則是表示食欲是夠覆蓋到四周的區(qū)域,默認(rèn)是UIRectEdgeAll,即上下左右四個方向都會覆蓋,那么為讓頂部不進(jìn)行眼神到導(dǎo)航欄覆蓋的區(qū)域,我們可以把頂部區(qū)域眼神去掉,實現(xiàn)代碼如下,self.extendedLayoutIncludesOpaqueBars
= NO;
self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight;
當(dāng)你在做的時候發(fā)現(xiàn)viewDidLoad的時候view的高度還是全屏,viewWillAppear已經(jīng)去掉navigationbar了,所以frame的設(shè)置放在了viewWillAppear中比較準(zhǔn)確。
@property(nonatomic,assign)BOOLautomaticallyAdjustsScrollViewInsetsNS_AVAILABLE_IOS(7_0);// Defaults to YES
//143.當(dāng)在一個viewController中有多個tableView之類的時候,要把這個屬性設(shè)置為NO,這樣多個tableview的位置就會是按照自己設(shè)定的來,而不會出現(xiàn)位置意外不對的情況
/* The preferredContentSize is used for any container laying out a child view controller.
*/
@property(nonatomic) CGSize preferredContentSizeNS_AVAILABLE_IOS(7_0);
//144.preferredContentSize來設(shè)置我們期望的childViewController的界面的大小
// These methods control the attributes of the status bar when this view controller is shown. They can be overridden in view controller subclasses to return the desired status bar attributes.
- (UIStatusBarStyle)preferredStatusBarStyleNS_AVAILABLE_IOS(7_0);// Defaults to UIStatusBarStyleDefault
//145.設(shè)置shown的ViewController的狀態(tài)欄樣式
- (BOOL)prefersStatusBarHiddenNS_AVAILABLE_IOS(7_0);// Defaults to NO
//146.設(shè)置狀態(tài)欄是否隱藏顯示
// Override to return the type of animation that should be used for status bar changes for this view controller. This currently only affects changes to prefersStatusBarHidden.
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimationNS_AVAILABLE_IOS(7_0);// Defaults to UIStatusBarAnimationFade
//147.重寫此方法設(shè)置狀態(tài)欄更新時候的動畫
// This should be called whenever the return values for the view controller's status bar attributes have changed. If it is called from within an animation block, the changes will be animated along with the rest of the animation block.
- (void)setNeedsStatusBarAppearanceUpdateNS_AVAILABLE_IOS(7_0);
//148.如果需要對狀態(tài)欄進(jìn)行刷新,調(diào)用此方法即可
/* This method returns either itself or the nearest ancestor that responds to the action. View controllers can return NO from canPerformAction:withSender: to opt out of being a target for a given action. */
- (UIViewController *)targetViewControllerForAction:(SEL)action sender:(id)senderNS_AVAILABLE_IOS(8_0);
//149.
/* This method will show a view controller appropriately for the current size-class environment. It's implementation calls
`[self targetViewControllerForAction:sender:]` first and redirects
accordingly if the return value is not `self`, otherwise it will present
the vc. */
- (void)showViewController:(UIViewController *)vc sender:(id)senderNS_AVAILABLE_IOS(8_0);
//150.-----------------
/* This method will show a view controller within the semantic "detail" UI associated with the current size-class environment. It's implementation calls? `[self targetViewControllerForAction:sender:]` first and redirects accordingly if the return value is not `self`, otherwise it will present the vc.? */
- (void)showDetailViewController:(UIViewController *)vc sender:(id)senderNS_AVAILABLE_IOS(8_0);
//151.--------------------------
@end
// To make it more convenient for applications to adopt rotation, a view controller may implement the below methods. Your UIWindow's frame should use [UIScreen mainScreen].bounds as its frame.
@interfaceUIViewController (UIViewControllerRotation)
//152.為UIViewController添加分類方法為了更好的適應(yīng)應(yīng)用的屏幕旋轉(zhuǎn)
// call this method when your return value from shouldAutorotateToInterfaceOrientation: changes
// if the current interface orientation does not match the current device orientation, a rotation may occur provided all relevant view controllers now return YES from shouldAutorotateToInterfaceOrientation:
+ (void)attemptRotationToDeviceOrientationNS_AVAILABLE_IOS(5_0);
//153.這個方法這樣使用:當(dāng)應(yīng)用的device orientation轉(zhuǎn)換方向,又希望interface orientation也跟著轉(zhuǎn)換方向時,不僅僅是將supportedInterfaceOrientations的返回值設(shè)置為目標(biāo)方向,仍需要調(diào)用attemptRotationToDeviceOrientation這個方法,這樣才能讓interface orientation和device orientation的方向立即保持一致。
// Applications should use supportedInterfaceOrientations and/or shouldAutorotate..
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientationNS_DEPRECATED_IOS(2_0,6_0);
//154.iOS6之前我們可以通過這個方法來單獨控制某個UIVewController的旋轉(zhuǎn)方向
// New Autorotation support.
- (BOOL)shouldAutorotateNS_AVAILABLE_IOS(6_0);
//155.決定是否之處多方向旋轉(zhuǎn)屏,返回NO不支持,只會支持默認(rèn)的UIInterfaceOrientaionMaskPortrait方向
- (NSUInteger)supportedInterfaceOrientationsNS_AVAILABLE_IOS(6_0);
//156.此方法的返回值決定interface orienation的旋轉(zhuǎn)方向
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentationNS_AVAILABLE_IOS(6_0);
//157.這個方法的作用是設(shè)置viewController在present時首選的默認(rèn)方向,返回一個interfaceOrientation
// The rotating header and footer views will slide out during the rotation and back in once it has completed.
- (UIView *)rotatingHeaderViewNS_DEPRECATED_IOS(2_0,8_0,"Header views are animated along with the rest of the view hierarchy");// Must be in the view hierarchy. Default returns nil.
//158.查詢當(dāng)前的導(dǎo)航視圖
- (UIView *)rotatingFooterViewNS_DEPRECATED_IOS(2_0,8_0,"Footer views are animated along with the rest of the view hierarchy");// Must be in the view hierarchy. Default returns nil.
//159.查詢當(dāng)前的標(biāo)簽視圖
@property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientationNS_DEPRECATED_IOS(2_0,8_0);
//160.interfaceOrientation是應(yīng)用界面的旋轉(zhuǎn)方向
// Notifies when rotation begins, reaches halfway point and ends.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)durationNS_DEPRECATED_IOS(2_0,8_0,"Implement viewWillTransitionToSize:withTransitionCoordinator: instead");
//161.應(yīng)用界面將要旋轉(zhuǎn)的時候前會調(diào)用,一般用來禁用某些控件或者停止某些正在運行的動作,比如播放視頻等等
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientationNS_DEPRECATED_IOS(2_0,8_0);
//162.這個發(fā)生在旋轉(zhuǎn)屏幕之后,一般用來啟用某些之前被禁用的控件或者是之前已經(jīng)正在運行的動作,如播放視頻等等
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)durationNS_DEPRECATED_IOS(3_0,8_0,"Implement viewWillTransitionToSize:withTransitionCoordinator: instead");
//163.這個方法發(fā)生在旋轉(zhuǎn)的過程中,一般用來定制翻轉(zhuǎn)后各個控件的位置大小等
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)durationNS_DEPRECATED_IOS(2_0,5_0);
//164.這個方法和163那個方法作用一樣,就是作用范圍時間不一樣,作為翻轉(zhuǎn)的前半段
- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientationNS_DEPRECATED_IOS(2_0,5_0);// The rotating header and footer views are offscreen.
//165.這個方法是在前半段旋轉(zhuǎn)之后發(fā)生,做一些相應(yīng)操作
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)durationNS_DEPRECATED_IOS(2_0,5_0);// A this point, our view orientation is set to the new orientation.
//166.這個方法是也是發(fā)生在旋轉(zhuǎn)過程中,和163一樣作樣,發(fā)生作用范圍在后半段
@end
// Many view controllers have a view that may be in an editing state or not- for example, a UITableView.? These view
// controllers can track the editing state, and generate an Edit|Done button to be used in a navigation bar.
@interfaceUIViewController (UIViewControllerEditing)
//167.為UIViewController添加分類方法實現(xiàn)可編輯的功能
@property(nonatomic,getter=isEditing)BOOLediting;
//168.bool值判斷是否可編輯
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;// Updates the appearance of the Edit|Done button item as necessary. Clients who override it must call super first.
//169.更新Edit|Done按鈕item的外觀
- (UIBarButtonItem *)editButtonItem;// Return an Edit|Done button that can be used as a navigation item's custom view. Default action toggles the editing state with animation.
//170.實現(xiàn)一個自定義的view,作為導(dǎo)航欄的Edit|Done按鈕。
@end
@interfaceUIViewController (UISearchDisplayControllerSupport)
//171.實現(xiàn)UISearchDisplayControllerSupport相關(guān)的分類方法
@property(nonatomic, readonly, retain) UISearchDisplayController *searchDisplayControllerNS_DEPRECATED_IOS(3_0,8_0);
//172.UIViewController自帶searchDisplayController屬性
@end
/*
This exception is raised when a child view controller's view is added into the view hierarchy and the first
superview of the child view controller's view that has a view controller is NOT the child view controller's
parent.
*/
UIKIT_EXTERNNSString *constUIViewControllerHierarchyInconsistencyExceptionNS_AVAILABLE_IOS(5_0);
//173.異常。因控制器的層次與視圖的層次不一致會引發(fā)該異常,當(dāng)視圖控制器的視圖添加到視圖層中,系統(tǒng)會遍歷視圖層來找到第一個擁有視圖控制器的父視圖。找到的該父視圖控制器也必須是剛添加的視圖的所對應(yīng)視圖控制器的父控制器。否則會拋出異常。當(dāng)視圖控制器通過addChildViewController方法被添加進(jìn)來后,也會進(jìn)行之前的一致性檢測。不存在俯視圖控制器的視圖控制器,也可以將其視圖添加到視圖層中。但通常極少數(shù)情況下才會用到這種方式。
/*
The methods in the UIContainerViewControllerProtectedMethods and the UIContainerViewControllerCallbacks
categories typically should only be called by subclasses which are implementing new container view
controllers. They may be overridden but must call super.
*/
@interfaceUIViewController (UIContainerViewControllerProtectedMethods)
//174.添加新類別ContainerViewController,那什么是ContainerViewController,意思就是一個viewController顯示的某部分內(nèi)容屬于另一個viewController,那么這個viewController就是一個container,比如UIKit的UINavigationController,UITabBarController
// An array of children view controllers. This array does not include any presented view controllers.
@property(nonatomic,readonly) NSArray *childViewControllersNS_AVAILABLE_IOS(5_0);
//175.數(shù)組用來存放子控制器
/*
If the child controller has a different parent controller, it will first be removed from its current parent
by calling removeFromParentViewController. If this method is overridden then the super implementation must
be called.
*/
- (void)addChildViewController:(UIViewController *)childControllerNS_AVAILABLE_IOS(5_0);
//176.添加子視圖控制器
/*
Removes the the receiver from its parent's children controllers array. If this method is overridden then
the super implementation must be called.
*/
- (void) removeFromParentViewControllerNS_AVAILABLE_IOS(5_0);
//177.從父控制器中移除子控制器
/*
This method can be used to transition between sibling child view controllers. The receiver of this method is
their common parent view controller. (Use [UIViewController addChildViewController:] to create the
parent/child relationship.) This method will add the toViewController's view to the superview of the
fromViewController's view and the fromViewController's view will be removed from its superview after the
transition completes. It is important to allow this method to add and remove the views. The arguments to
this method are the same as those defined by UIView's block animation API. This method will fail with an
NSInvalidArgumentException if the parent view controllers are not the same as the receiver, or if the
receiver explicitly forwards its appearance and rotation callbacks to its children. Finally, the receiver
should not be a subclass of an iOS container view controller. Note also that it is possible to use the
UIView APIs directly. If they are used it is important to ensure that the toViewController's view is added
to the visible view hierarchy while the fromViewController's view is removed.
*/
- (void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void(^)(void))animations completion:(void(^)(BOOLfinished))completionNS_AVAILABLE_IOS(5_0);
//178.不同的view放在不同的viewController中,用到才去創(chuàng)建,那么這個方法是實現(xiàn)兩個自控制器的切換,參數(shù)fromViewController是當(dāng)前顯示在父控制器中的子視圖控制器,toViewController是將要顯示的子視圖控制器,duration完成過渡時間,options指定的過渡效果,animations動畫,completion過渡完成后,回調(diào)的block塊操作
// If a custom container controller manually forwards its appearance callbacks, then rather than calling
// viewWillAppear:, viewDidAppear: viewWillDisappear:, or viewDidDisappear: on the children these methods
// should be used instead. This will ensure that descendent child controllers appearance methods will be
// invoked. It also enables more complex custom transitions to be implemented since the appearance callbacks are
// now tied to the final matching invocation of endAppearanceTransition.
- (void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
//179.beginAppearanceTransition觸發(fā)相應(yīng)的viewVWillAppear????????????
- (void)endAppearanceTransition__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
//180.endAppearanceTransition觸發(fā)相應(yīng)的viewWillDisappear
// Override to return a child view controller or nil. If non-nil, that view controller's status bar appearance attributes will be used. If nil, self is used. Whenever the return values from these methods change, -setNeedsUpdatedStatusBarAttributes should be called.
- (UIViewController *)childViewControllerForStatusBarStyleNS_AVAILABLE_IOS(7_0);
//181.設(shè)置子控制器的狀態(tài)欄樣式
- (UIViewController *)childViewControllerForStatusBarHiddenNS_AVAILABLE_IOS(7_0);
//182.實現(xiàn)此方法來指定要控制的狀態(tài)欄隱藏和取消隱藏狀態(tài)
// Call to modify the trait collection for child view controllers.
- (void)setOverrideTraitCollection:(UITraitCollection *)collection forChildViewController:(UIViewController *)childViewControllerNS_AVAILABLE_IOS(8_0);
//183.通過此方法可以為子控制器重新設(shè)置traintCollection的值,一般情況下traitCollection值從父controller傳到子controller是不做修改的,而我們自己實現(xiàn)一個容器controller的時候,我們可以使用這個方法進(jìn)行調(diào)整
- (UITraitCollection *)overrideTraitCollectionForChildViewController:(UIViewController *)childViewControllerNS_AVAILABLE_IOS(8_0);
//184.這個方法可以幫助我們獲得子控制器的trainCollection值。
@end
@interfaceUIViewController (UIContainerViewControllerCallbacks)
//185.關(guān)于ContainerViewController一些回調(diào)方法
/*
This method is consulted to determine if a view controller manually forwards its containment callbacks to
any children view controllers. Subclasses of UIViewController that implement containment logic may override
this method. The default implementation returns YES. If it is overridden and returns NO, then the subclass is
responsible for forwarding the following methods as appropriate - viewWillAppear: viewDidAppear: viewWillDisappear:
viewDidDisappear: willRotateToInterfaceOrientation:duration:
willAnimateRotationToInterfaceOrientation:duration: didRotateFromInterfaceOrientation:
*/
- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllersNS_DEPRECATED_IOS(5_0,6_0);
//186.在iOS5中覆蓋此方法可以關(guān)閉appearance callbacks的自動傳遞特性
- (BOOL)shouldAutomaticallyForwardRotationMethodsNS_DEPRECATED_IOS(6_0,8_0,"Manually forward viewWillTransitionToSize:withTransitionCoordinator: if necessary");
//187.在iOS6之后,覆蓋此方法可以禁止掉旋轉(zhuǎn)回調(diào)自動傳遞的特性(因為有時候作為容器的childViewController可能不需要這些方法傳遞給所有的childViewControllers,只需要傳遞給正在顯示的childVieControllrer)
- (BOOL)shouldAutomaticallyForwardAppearanceMethodsNS_AVAILABLE_IOS(6_0);
//188.在iOS6之后需要覆蓋整個方法來關(guān)閉appearance callbacks的自動傳遞特性
/*
These two methods are public for container subclasses to call when transitioning between child
controllers. If they are overridden, the overrides should ensure to call the super. The parent argument in
both of these methods is nil when a child is being removed from its parent; otherwise it is equal to the new
parent view controller.
addChildViewController: will call [child willMoveToParentViewController:self] before adding the
child. However, it will not call didMoveToParentViewController:. It is expected that a container view
controller subclass will make this call after a transition to the new child has completed or, in the
case of no transition, immediately after the call to addChildViewController:. Similarly
removeFromParentViewController: does not call [self willMoveToParentViewController:nil] before removing the
child. This is also the responsibilty of the container subclass. Container subclasses will typically define
a method that transitions to a new child by first calling addChildViewController:, then executing a
transition which will add the new child's view into the view hierarchy of its parent, and finally will call
didMoveToParentViewController:. Similarly, subclasses will typically define a method that removes a child in
the reverse manner by first calling [child willMoveToParentViewController:nil].
*/
- (void)willMoveToParentViewController:(UIViewController *)parentNS_AVAILABLE_IOS(5_0);
//189.當(dāng)addChildViewController:接口建立了邏輯上的父子關(guān)系,接口的邏輯中會自動調(diào)用willMoveToParentViewController這個方法,在即將移動顯示ParentViewController的時候調(diào)用
- (void)didMoveToParentViewController:(UIViewController *)parentNS_AVAILABLE_IOS(5_0);
//190.這個方法和上面這個方法類似,在移動顯示ParentViewController之后自動調(diào)用
@end
@interfaceUIViewController (UIStateRestoration)
//191.UIStateRestoration提供持久數(shù)據(jù)的接口
@property(nonatomic, copy) NSString *restorationIdentifierNS_AVAILABLE_IOS(6_0);
//192.這個屬性是用來標(biāo)示是否支持保存,恢復(fù)視圖狀態(tài)信息
@property(nonatomic, readwrite, assign) Class restorationClassNS_AVAILABLE_IOS(6_0);
//193.
- (void) encodeRestorableStateWithCoder:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);
//194.保存視圖狀態(tài)相關(guān)信息
- (void) decodeRestorableStateWithCoder:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);
//195.恢復(fù)和保持視圖狀態(tài)相關(guān)信息
- (void) applicationFinishedRestoringStateNS_AVAILABLE_IOS(7_0);
//196.其他對象解碼完成后,系統(tǒng)會調(diào)用此方法
@end
@interfaceUIViewController (UIConstraintBasedLayoutCoreMethods)
//197.增加分類基于布局約束的核心方法
/* Base implementation sends -updateConstraints to the view.
When a view has a view controller, this message is sent to the view controller during
the autolayout updateConstraints pass in lieu of sending updateConstraints directly
to the view.
You may override this method in a UIViewController subclass for updating custom
constraints instead of subclassing your view and overriding -[UIView updateConstraints].
Overrides must call super or send -updateConstraints to the view.
*/
- (void)updateViewConstraintsNS_AVAILABLE_IOS(6_0);
//198.更新布局約束的方法,viewController的view再更新視圖布局時,會先調(diào)用這個方法,可以通過重寫這個方法去更新當(dāng)前view的內(nèi)部布局,而不用再繼承這個view去重寫updateConstraints方法,記得注意重寫時,要調(diào)用super或者調(diào)用當(dāng)前view的updateContraints方法。
@end
@protocolUIViewControllerTransitioningDelegate;
//199.viewController過渡的代理協(xié)議
@interfaceUIViewController(UIViewControllerTransitioning)
@property(nonatomic,assign)id transitioningDelegateNS_AVAILABLE_IOS(7_0);
//200.實例化協(xié)議屬性
@end
@interfaceUIViewController (UILayoutSupport)
// These objects may be used as layout items in the NSLayoutConstraint API
@property(nonatomic,readonly,retain)id topLayoutGuideNS_AVAILABLE_IOS(7_0);
//201.這個屬性是通過計算viewController->view->top到覆蓋這個view最下層的那個bar-》bottom的距離
@property(nonatomic,readonly,retain)id bottomLayoutGuideNS_AVAILABLE_IOS(7_0);
//202.這個屬性是通過計算viewController->view->bottom到覆蓋這個biew上層那個bar-top的距離
@end
@classNSExtensionContext;//????????????????????????????????????
//203.引入NSExtensionContext類,iOS8新增的一個跨站上下文屬性的extensionContext,來處理containing app與擴(kuò)展之間的通信,上下文的類型是NSExtensionContext。
@interfaceUIViewController(NSExtensionAdditions)
//204.添加分類并且綁定協(xié)議
// Returns the extension context. Also acts as a convenience method for a view controller to check if it participating in an extension request.
@property(nonatomic,readonly,retain) NSExtensionContext *extensionContextNS_AVAILABLE_IOS(8_0);
//205.實例化NSExtensionContext屬性