<欢迎大家加入iOS开发学习交流群:QQ529560119>

/*

     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.

     */

   @class UIView;

    //1. UIViewController是管理一个view的最主要的基类,当一个view要显示或者消失的时候。UIViewController有对应方法会被调用。

子类能够重写loadView方法去创建他们自己定义的view。或者指定一个nib被自己主动载入实现。这个类也是对于代理,数据源协议方法和一些其它控制器的方法展示实现一个非常好的空间地方。

    

   @class UINavigationItem, UIBarButtonItem, UITabBarItem;

    //2. UINavigationItem是放置在导航栏中的,包括.rightBarButtonItem,.leftBarButtonItem,titleView,而这三个button又能够归为UIBarButtonItem类,并通过它创建。

UITabBarItem是分栏控制器底部切换itembutton。

    

   @class UISearchDisplayController

    //3. UISearchDisplayController是专门为UITableView搜索封装的一个类。

    

   @class UIPopoverController;

    //4.UIPopverController是IPad特有的类,不能在iphone上使用。它负责控制Popover视图。Popover是一种暂时视图。它以“漂浮”的形式出如今视图里面。

    

   @class UIStoryboard, UIStoryboardSegue;

    //5. UIStoryboard是iOS5以后新增的内容,是以故事版的形式来展示界面之间的逻辑业务关系。前端开发眼下有三种方式(纯代码,代码+xib,UIStoryboard),UIStoryboard为当中一种。

而UIStoryboardSegue—————————————————————

   @class UIScrollView

    //6. UIScrollView在UIKit中是UIScrollView类,是容器类型的视图。它有三个子类—UITextView。UITableview和UICollectionView。它们在内容超出屏幕时提供水平或垂直滚动栏。

   @protocol UIViewControllerTransitionCoordinator;

    //7.这就涉及到自己定义viewController容器转场,iOS7引入的新特性自己定义viewController转场。-----------

    

   typedef
NS_ENUM(NSInteger, UIModalTransitionStyle) {

        UIModalTransitionStyleCoverVertical =,

        UIModalTransitionStyleFlipHorizontal,

        UIModalTransitionStyleCrossDissolve,

        UIModalTransitionStylePartialCurl_2),

    };

    //8.UIModalTransitionStyle是弹出模态ViewController时的四种动画风格。UIModalTransitionStyleCoverVertical是从底部滑入,UIModalTransitionStyleFlipHorizontal是水平翻转。UIModalTransitionStyleCrossDissolve是交叉溶解,UIModalTransitionStylePartialCurl是翻页效果。

    

   typedef
NS_ENUM(NSInteger, UIModalPresentationStyle) {

        UIModalPresentationFullScreen =,

        UIModalPresentationPageSheet_2),

        UIModalPresentationFormSheet_2),

        UIModalPresentationCurrentContext_2),

        UIModalPresentationCustom_0),

        UIModalPresentationOverFullScreen_0),

        UIModalPresentationOverCurrentContext_0),

        UIModalPresentationPopover_0),

        UIModalPresentationNone_0) = -,

    };

    //9。UIModalPresentationStyle是弹出模态ViewController时弹出风格,UIModalPresentationFullScreen是弹出VC时,VC充满全屏。UIModalPresentationPageSheet是假设设备横屏,VC的显示方式则从横屏下方開始,UIModalPresentationFormSheet是VC显示都是从底部,宽度和屏幕宽度一样。UIModalPresentationCurrentContext是VC的弹出方式和VC父VC的弹出方式同样。.....UIModalPresentationNone測试时会崩溃,出错'The
specified modal presentation style doesn't have a corresponding presentation controller.'-------------------------------

    

   @protocol UIContentContainer <NSObject>

    //10.iOS8之后,加入了新的一组协议,UIViewController对这组协议提供了默认的实现,我们自己定义ViewConttroller的时候能够重写这些方法来调整视图布局。

    

    

   _0);

    //11.我们能够使用preferredContentSize来设置我们期望的childViewController的界面的大小。

    

    

    - (_0);

    //12.这种方法告诉当前容器viewController,我们能够在这种方法里依据新的size对界面进行调整。

   /*

     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.

     */

    

    - (_0);

    //13.重写方法来调整视图布局,当在这些情况下该方法会被调用,当前viewController没有使用auto layout布局,childrenViewController的view使用了autoLayout布局childrenViewController View-systemLayoutSizeFittingSize:方法返回的值的改变(view由于内容的改变,size也出现了变化)

   /*

     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:(_0);

    //14.同上,依然由于iOS8上size class概念的提出,UIViewConteroller支持了UIConntentContainer这样一组新的协议,重写这些方法能够调整视图布局,一个容器viewController能够使用这种方法设置childViewController的size,当容器viewControllerViewWillTransitionTosize:withTransitionCoordinator:被调用时(我们重写这种方法时要调用super),sizeForChildContentContainer方法将被调用。

然后我们能够把须要设置desire发送给childViewController。当我们设置的这个size和当前childViewController的size一样,那么childViewController的viewWillTransitionToSize方法将不会被调用。sizeForChildContentContainer默认的实现是返回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.

     */

    - (_0);

    //15.viewController的view的size被他的parent Controller改变时,会触发这种方法(比方rootViewController在它的window旋转的时候)我们重写这种方法时。确保要调用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
<UIViewControllerTransitionCoordinator>)coordinator
NS_AVAILABLE_IOS(_0);

    //17.当viewController的traitCollection的值将要改变时会调用这种方法。这种方法是在UITraitEnvironment协议方法traitCollectionDidChange:之前被调用。

我们在重写这种方法时候也要确保要调用super来保证消息的传递。

比方,我们能够像这样在traintCollection值改变时,对试图做对应的动画进行调整。

   @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.

   _0);

    //18.

    

   _0)@interface UIViewController : UIResponder
<NSCoding, UIAppearanceContainer, UITraitEnvironment, UIContentContainer> {

    //19.UIViewController继承自UIResponder类,并实现NSCoding(实现归档操作),UIAppearanceContainer(同意开发人员对UI控件通过定制都能够呈现各种外观),UITraitEnvironment(SizeClasses适配理念。通过内部的traitCollection属性,能够拿到对应的UITraitCollection对象。从而得知当前的SizeClass。进一步确定界面的布局),UIContentContainer协议(调整视图布局)

       

       @package

    //20.实例变量范围类型@package,对于framework内部相当于@protect。对于framework外部相当于@private。

        UIView           *_view;

    //21.view成员变量

        UITabBarItem     *_tabBarItem;

       //22.分栏控制器的itembutton成员变量

        UINavigationItem *_navigationItem;

        //23.导航栏item成员变量

        NSArray          *_toolbarItems;

        //24.数组用来保存工具条buttonitem的成员变量

        NSString         *_title;

        //25.标题title成员变量

        NSString         *_nibName;

        //26.nib名称成员变量

        NSBundle         *_nibBundle;

        //27.bundle成员变量

        UIViewController *_parentViewController;// Nonretained

        //28.取父viewConreoller成员变量

        UIViewController *_childModalViewController;

        //29.取子模态ViewController成员变量

        UIViewController *_parentModalViewController;// Nonretained

        //30.取父模态ViewController成员变量

        UIViewController *_previousRootViewController;// Nonretained

        //31.取上一个根previous的成员变量

        UIView           *_modalTransitionView;

        //32.模态过渡view的成员变量

        UIResponder    *_modalPreservedFirstResponder;

        //33.第一个保存Responder成员变量

       id               _dimmingView;

        //34.变暗的view-----------

       id               _dropShadowView;

        //35.删除阴影view成员变量--------------

       id                _currentAction;

        //36.当前动作方法

        UIStoryboard     *_storyboard;

        //37.storyboard成员变量

        NSArray          *_storyboardSegueTemplates;

        //38.存放storyboardSegue的数组

        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.模态视图过渡动画样式

        UIModalPresentationStyle _modalPresentationStyle;

        //46.模态视图呈现样式

        UIInterfaceOrientation _lastKnownInterfaceOrientation;

        //47.当前程序界面的旋转方向

        UIPopoverController*    _popoverController;

        //48.IPad专用的一种暂时视图,以漂浮的形式出如今屏幕表面。

        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.这种方法是载入对应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属性,假设当你第一次调用[self loadView]方法而view还没有被设置,子类必须要调用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方法内部能够创建自己定义的view。有一前提是没有使用xib。

还有这种方法绝对不能直接主动去调用。

    

    - (_0,_0);

    //103.view将要销毁的时候会调用这种方法(只是如今已弃用)

    

_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已经被销毁的时候会调用这种方法(如今也已弃用)

   

    - (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载入完毕的时候调用,在此方法内部对view做一些渲染的事情,做一些初始化的操作,而且运行顺序是在loadView方法调用之后调用。

    

    - (_0);

    //106.推断view是否被载入完毕

    

    @property(nonatomic, readonly, copy) NSString *nibName;    // The name of the nib to be loaded to instantiate the view.

    //107.nibName作为属性,载入对应的nib。

    

   @property(nonatomic, readonly, retain) NSBundle *nibBundle;// The bundle from which to load the nib.

    //108.bundle是一个资源文件夹,包括nib文件,nibBunlde作为属性

    

   _0);

    //109.storyboard属性,iOS5出现

    

    - (_0);

    //110.使用stortboard时利用segue进行页面跳转的方法

    

_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.这份方法是决定是否运行segeue的关键。可在内部做一些时间推断,返回yes。将运行performSegueWithIdentifier:方法,返回no不运行performSegueWithIdentifier:。默认返回yes,能够运行

    

    - (_0);

    //112.当用storyboard而且触发segue时,系统会自己主动调用这种方法。能够重写这种方法。在内部做一些类与类传递数据的操作

    

    // 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)sender
NS_AVAILABLE_IOS(_0);

    //113.我们一般在子控制器中通过实现canperformUnwindSegueAction:fromViewController:withSender:来决定要不要运行对应的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:(_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
*)identifier _0);

    //115.这种方法用来返回自己定义的Unwind Segue实例

    

    - (void)viewWillAppear:(BOOL)animated;   // Called when the view is about to made
visible. Default does nothing

   //116.这种方法是当view将要显示的时候被调用

    

    - (void)viewDidAppear:(BOOL)animated;    // Called when the view has been fully
transitioned onto the screen. Default does nothing

    //117.这种方法是当view已经显示的时候被调用

    

    - (void)viewWillDisappear:(BOOL)animated;// Called when the view is dismissed,
covered or otherwise hidden. Default does nothing

    //118.这种方法是当view将要消失的时候调用

    

    - (void)viewDidDisappear:(BOOL)animated; // Called after the view was dismissed,
covered or otherwise hidden. Default does nothing

    //119.这种方法是当view已经消失的时候调用

    

    // Called just before the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.

    - (_0);

    //120.在又一次布局子view前的时候会调用

    

    // Called just after the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.

    - (_0);

    //120.在又一次布局子view后的时候会调用

    

    @property(nonatomic,copy) NSString *title; // Localized title for use by a parent controller.

    //121.标题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.当应用程序收到内存警告的时候会调用这种方法 ,做对应的解决内存警告的操作

    

   /*

     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.

   _0,_0);

    //124.得到模态视图控制器

    

    // The view controller that was presented by this view controller or its nearest ancestor.

   _0);

    //125.------------------------

    

    // The view controller that presented this view controller (or its farthest ancestor.)

   _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)
BOOL definesPresentationContext
NS_AVAILABLE_IOS(_0);

    //127.
决定哪个父viewController的view应当呈如今当前,假设没有父viewController,呈现的将是根视图控制器。

    

    

    // A controller that defines the presentation context can also specify the modal transition style if this property is true.

   @property(nonatomic,assign)
BOOL providesPresentationContextTransitionStyle
_0);

    //128.假设这个属性是true的话,能够定义模态过渡转场的样式

    

    

   /*

     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]).

     */

    

    - (_0);

    //129.推断viewController是否正在展示

    

    - (_0);

    //130.推断viewController是否正在消失

    

    - (_0);

    //131.推断是否正在向父viewController移动

    

    - (_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))completion
NS_AVAILABLE_IOS(_0);

    //133.这种方法能够实现从当前viewController模态跳转到还有一个viewController,completion可在viewDidAppear后回调

    

    // The completion handler, if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked.

    - (void)dismissViewControllerAnimated: (BOOL)flag completion: (void
(^)(void))completion
NS_AVAILABLE_IOS(_0);

    //134.这种方法能够实现退出当前viewController由模态方式展现出来的,completion可在viewDidDisappear后回调

    

    // Display another view controller as a modal child. Uses a vertical sheet transition if animated.This method has been replaced by presentViewController:animated:completion:

    - (_0,_0);

    //135.呈现模态视图

    

    // Dismiss the current modal child. Uses a vertical sheet transition if animated. This method has been replaced by dismissViewControllerAnimated:completion:

    - (_0,_0);

    //136.退出模态视图

    

   /*

     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.

     */

   _0);

    //137.当一个viewController以模态方式呈现的时候,通过modalTransitionStyle可设置过渡动画样式

    

   _2);

    //137.当一个viewController以模态方式呈现的时候,通过modalPresentationStyle可设置呈现的样式

    

    // 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)
BOOL modalPresentationCapturesStatusBarAppearance
_0);

    //138.这个属性是控制是否显示状态栏

    

    

    // Presentation modes may keep the keyboard visible when not required. Default implementation affects UIModalPresentationFormSheet visibility.

    - (_3);

    //139.这个API是于关闭键盘相关的,通常情况下单纯的使用resignFirstResponder就可以关闭键盘,可是在UIModalPresentationFormSheet下的视图是无法用resignFirstResponder这个API。是由于在进入到此模式后。系统将disablesAutomaticKeyboardDismissal的方法返回值设置成了YES,所以解决方法非常easy,又一次实现disablesAutomaticKeyboardDismissal,假设是直接使用viewController则能够在实现文件里又一次实现这个API,将返回改为NO后,就可以正常使用resignFirstResponder方法隐藏键盘。但非常多时候我们是把viewController放在UINavigationController中的,这样的情况下直接在viewController这里面实现disablesAutomaticKeyboardDismissal依然失效,而应发iUINavigationController中实现这个API。

    

   @property(nonatomic,assign)
BOOL wantsFullScreenLayout
NS_DEPRECATED_IOS(_0,_0);
// Deprecated in 7_0, Replaced by the following:

    //140.wantsFullScreenLayout=true。状态栏的高度就不会被算在视图里。也就是说有没有状态栏y坐标始终都是从0算起(只是此属性在iOS7已被弃用,以下属性替代此功能)

   _0);//
Defaults to UIRectEdgeAll

    //141.iOS7的新属性,默认值为UIRectEdgeAll。在navigationController中view的默认布局从navigationBar開始,self.edgesForExtendedLayout=UIRectEdgeNone,则布局控件减去navigationBar----------------

    

_0);//
Defaults to NO, but bars are translucent(透明的。半透明的)by default on 7_0.

    //142.在iOS7中UIViewController的wantsFullScreenLayout已经被舍弃。不在提供控件自己主动展示到导航栏以下这个属性。全部的UIViewController创建后默认就是full
Screen的,因此假设带导航栏的应用界面中的部分控件会被导航栏覆盖掉。要解决这个情况能够使用iOS7中UIVIewController新增的属性extendedLayoutIncludesOpaqueBars和edgesForExtendedLayout来解决。

当中这个属性指定了当bar使用了不透明图片时,视图是否眼神至bar所在区域,默认值是NO,而edgesForExtendedLayout则是表示食欲是够覆盖到四周的区域。默认是UIRectEdgeAll。即上下左右四个方向都会覆盖,那么为让顶部不进行眼神到导航栏覆盖的区域,我们能够把顶部区域眼神去掉。实现代码例如以下,self.extendedLayoutIncludesOpaqueBars
= NO;

self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight;

    当你在做的时候发现viewDidLoad的时候view的高度还是全屏。viewWillAppear已经去掉navigationbar了,所以frame的设置放在了viewWillAppear中比較准确。

    

   @property(nonatomic,assign)
BOOL automaticallyAdjustsScrollViewInsets
NS_AVAILABLE_IOS(_0);// Defaults to YES

    //143.当在一个viewController中有多个tableView之类的时候。要把这个属性设置为NO,这样多个tableview的位置就会是依照自己设定的来,而不会出现位置意外不正确的情况

    /* The preferredContentSize is used for any container laying out a child view controller.

     */

   _0);

    //144.preferredContentSize来设置我们期望的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)preferredStatusBarStyle_0);// Defaults
to UIStatusBarStyleDefault

    //145.设置shown的ViewController的状态栏样式

    

    - (_0);//
Defaults to NO

    //146.设置状态栏是否隐藏显示

    

    // 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)preferredStatusBarUpdateAnimation_0);//
Defaults to UIStatusBarAnimationFade

    //147.重写此方法设置状态栏更新时候的动画

    

    // 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.

    - (_0);

    //148.假设须要对状态栏进行刷新。调用此方法就可以

    

    /* 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:(_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. */

    - (_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.  */

    - (_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.

   @interface UIViewController (UIViewControllerRotation)

    //152.为UIViewController加入分类方法为了更好的适应应用的屏幕旋转

    

    // 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:

    + (_0);

    //153.这种方法这样使用:当应用的device orientation转换方向。又希望interface orientation也跟着转换方向时。不仅仅是将supportedInterfaceOrientations的返回值设置为目标方向,仍须要调用attemptRotationToDeviceOrientation这种方法。这样才干让interface
orientation和device orientation的方向马上保持一致。

    

    // Applications should use supportedInterfaceOrientations and/or shouldAutorotate..

    - (_0,_0);

    //154.iOS6之前我们能够通过这种方法来单独控制某个UIVewController的旋转方向

    

    // New Autorotation support.

    - (_0);

    //155.决定是否之处多方向旋转屏,返回NO不支持,仅仅会支持默认的UIInterfaceOrientaionMaskPortrait方向

    

    - (NSUInteger)supportedInterfaceOrientations_0);

    //156.此方法的返回值决定interface orienation的旋转方向

    

    // Returns interface orientation masks.

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation_0);

    //157.这种方法的作用是设置viewController在present时首选的默认方向,返回一个interfaceOrientation

    

    // The rotating header and footer views will slide out during the rotation and back in once it has completed.

_0,"Header
views are animated along with the rest of the view hierarchy");    // Must be in the view hierarchy. Default returns nil.

    //158.查询当前的导航视图

    

_0,"Footer
views are animated along with the rest of the view hierarchy");    // Must be in the view hierarchy. Default returns nil.

    //159.查询当前的标签视图

    

   _0,_0);

    //160.interfaceOrientation是应用界面的旋转方向

    

    // Notifies when rotation begins, reaches halfway point and ends.

    - (_0,_0,"Implement
viewWillTransitionToSize:withTransitionCoordinator: instead");

    //161.应用界面将要旋转的时候前会调用。一般用来禁用某些控件或者停止某些正在运行的动作。比方播放视频等等

    

    - (_0,_0);

    //162.这个发生在旋转屏幕之后,一般用来启用某些之前被禁用的控件或者是之前已经正在运行的动作,如播放视频等等

    

    - (_0,_0,"Implement
viewWillTransitionToSize:withTransitionCoordinator: instead");

    //163.这种方法发生在旋转的过程中,一般用来定制翻转后各个控件的位置大小等

    

    - (_0,_0);

    //164.这种方法和163那个方法作用一样。就是作用范围时间不一样。作为翻转的前半段

    

    - (_0,_0);
// The rotating header and footer views are offscreen.

    //165.这种方法是在前半段旋转之后发生。做一些对应操作

    

    - (_0,_0);
// A this point, our view orientation is set to the new orientation.

    //166.这种方法是也是发生在旋转过程中,和163一样作样,发生作用范围在后半段

    

   @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.

   @interface UIViewController (UIViewControllerEditing)

    //167.为UIViewController加入分类方法实现可编辑的功能

    

   @property(nonatomic,getter=isEditing)
BOOL editing;

    //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|Donebuttonitem的外观

    

    - (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.实现一个自己定义的view,作为导航栏的Edit|Donebutton。

    

   @end

    

   @interface UIViewController (UISearchDisplayControllerSupport)

    //171.实现UISearchDisplayControllerSupport相关的分类方法

    

   _0,_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.

     */

   _0);

    //173.异常。因控制器的层次与视图的层次不一致会引发该异常,当视图控制器的视图加入到视图层中,系统会遍历视图层来找到第一个拥有视图控制器的父视图。找到的该父视图控制器也必须是刚加入的视图的所对应视图控制器的父控制器。

否则会抛出异常。

当视图控制器通过addChildViewController方法被加入进来后,也会进行之前的一致性检測。

不存在鸟瞰图控制器的视图控制器,也能够将其视图加入到视图层中。但通常极少数情况下才会用到这样的方式。

    

   /*

     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.

     */

   @interface UIViewController (UIContainerViewControllerProtectedMethods)

    //174.加入新类别ContainerViewController。那什么是ContainerViewController,意思就是一个viewController显示的某部分内容属于还有一个viewController,那么这个viewController就是一个container。比方UIKit的UINavigationController。UITabBarController

    

    // An array of children view controllers. This array does not include any presented view controllers.

   _0);

    //175.数组用来存放子控制器

    

   /*

     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.

     */

    - (_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.

     */

    - (_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:(_0);

    //178.不同的view放在不同的viewController中,用到才去创建,那么这种方法是实现两个自控制器的切换,參数fromViewController是当前显示在父控制器中的子视图控制器,toViewController是将要显示的子视图控制器。duration完毕过渡时间。options指定的过渡效果。animations动画。completion过渡完毕后,回调的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触发对应的viewVWillAppear????????????

    

    - (void)endAppearanceTransition__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

    //180.endAppearanceTransition触发对应的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 *)childViewControllerForStatusBarStyle_0);

    //181.设置子控制器的状态栏样式

    

    - (UIViewController *)childViewControllerForStatusBarHidden_0);

    //182.实现此方法来指定要控制的状态栏隐藏和取消隐藏状态

    

    // Call to modify the trait collection for child view controllers.

    - (_0);

    //183.通过此方法能够为子控制器又一次设置traintCollection的值。普通情况下traitCollection值从父controller传到子controller是不做改动的。而我们自己实现一个容器controller的时候。我们能够使用这种方法进行调整

    

    - (UITraitCollection *)overrideTraitCollectionForChildViewController:(UIViewController *)childViewController_0);

    //184.这种方法能够帮助我们获得子控制器的trainCollection值。

   @end

    

   @interface UIViewController (UIContainerViewControllerCallbacks)

    //185.关于ContainerViewController一些回调方法

    

   /*

     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:

     */

    

    - (_0,_0);

    //186.在iOS5中覆盖此方法能够关闭appearance callbacks的自己主动传递特性

    

_0,"Manually
forward viewWillTransitionToSize:withTransitionCoordinator: if necessary");

    //187.在iOS6之后。覆盖此方法能够禁止掉旋转回调自己主动传递的特性(由于有时候作为容器的childViewController可能不须要这些方法传递给全部的childViewControllers,仅仅须要传递给正在显示的childVieControllrer)

    

    

    - (_0);

    //188.在iOS6之后须要覆盖整个方法来关闭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].

     */

    - (_0);

    //189.当addChildViewController:接口建立了逻辑上的父子关系,接口的逻辑中会自己主动调用willMoveToParentViewController这种方法,在即将移动显示ParentViewController的时候调用

    

    - (_0);

    //190.这种方法和上面这种方法相似,在移动显示ParentViewController之后自己主动调用

    

   @end

    

   @interface UIViewController (UIStateRestoration) <UIStateRestoring>

    //191.UIStateRestoration提供持久数据的接口

    

   _0);

    //192.这个属性是用来标示是否支持保存,恢复视图状态信息

    

   _0);

    //193.

    

    - (_0);

    //194.保存视图状态相关信息

    

    - (_0);

    //195.恢复和保持视图状态相关信息

    

    - (_0);

    //196.其它对象解码完毕后,系统会调用此方法

    

   @end

    

   @interface UIViewController (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.

     */

    - (_0);

    //198.更新布局约束的方法。viewController的view再更新视图布局时。会先调用这种方法,能够通过重写这种方法去更新当前view的内部布局,而不用再继承这个view去重写updateConstraints方法,记得注意重写时,要调用super或者调用当前view的updateContraints方法。

    

   @end

    

   @protocol UIViewControllerTransitioningDelegate;

    //199.viewController过渡的代理协议

    

   @interface UIViewController(UIViewControllerTransitioning)

    

   @property (nonatomic,assign)
id <UIViewControllerTransitioningDelegate> transitioningDelegate
_0);

    //200.实例化协议属性

    

   @end

    

   @interface UIViewController (UILayoutSupport)

    // These objects may be used as layout items in the NSLayoutConstraint API

   @property(nonatomic,readonly,retain)
id<UILayoutSupport> topLayoutGuide
NS_AVAILABLE_IOS(_0);

    //201.这个属性是通过计算viewController->view->top到覆盖这个view最下层的那个bar-》bottom的距离

    

   @property(nonatomic,readonly,retain)
id<UILayoutSupport> bottomLayoutGuide
NS_AVAILABLE_IOS(_0);

    //202.这个属性是通过计算viewController->view->bottom到覆盖这个biew上层那个bar-top的距离

    

   @end

    

    @class NSExtensionContext;//????????????????????????????????????

    //203.引入NSExtensionContext类,iOS8新增的一个跨站上下文属性的extensionContext,来处理containing
app与扩展之间的通信,上下文的类型是NSExtensionContext。

    

   @interface UIViewController(NSExtensionAdditions) <NSExtensionRequestHandling>

    //204.加入分类而且绑定协议

    

    // Returns the extension context. Also acts as a convenience method for a view controller to check if it participating in an extension request.

   _0);

    //205.实例化NSExtensionContext属性

UIViewController所有API的学习。的更多相关文章

  1. Rest API 开发 学习笔记(转)

    Rest API 开发 学习笔记 概述 REST 从资源的角度来观察整个网络,分布在各处的资源由URI确定,而客户端的应用通过URI来获取资源的表示方式.获得这些表徵致使这些应用程序转变了其状态.随着 ...

  2. ava如何实现系统监控、系统信息收集、sigar开源API的学习(转)

    ava如何实现系统监控.系统信息收集.sigar开源API的学习(转) 转自:http://liningjustsoso.iteye.com/blog/1254584 首先给大家介绍一个开源工具Sig ...

  3. JavaSE中线程与并行API框架学习笔记——线程为什么会不安全?

    前言:休整一个多月之后,终于开始投简历了.这段时间休息了一阵子,又病了几天,真正用来复习准备的时间其实并不多.说实话,心里不是非常有底气. 这可能是学生时代遗留的思维惯性--总想着做好万全准备才去做事 ...

  4. TensorLayer官方中文文档1.7.4:API – 强化学习

    API - 强化学习¶ 强化学习(增强学习)相关函数. discount_episode_rewards([rewards, gamma, mode]) Take 1D float array of ...

  5. abp学习(四)——根据入门教程(aspnetMVC Web API进一步学习)

    Introduction With AspNet MVC Web API EntityFramework and AngularJS 地址:https://aspnetboilerplate.com/ ...

  6. 前后端分离&接口API设计学习报告

    接口API设计学习报告 15331023 陈康怡 什么是API? API即Application Programming Interface.API是一种通道,负责一个程序与另一个程序的沟通.而对于w ...

  7. Android API Guides 学习笔记---Application Fundamentals(一)

    今天开始学习google官网上的API guides ,主要读了Application Fundamentals这一章节,此章节介绍了一个App的基本组成,共包括四大部分内容. 1.      App ...

  8. ArcGIS API Reference & Flex API samples学习进度备忘

    书签:跳过:另外跳过的内容有待跟进 __________________学习资源: 1.http://help.arcgis.com/en/webapi/flex/apiref/index.html ...

  9. JavaSE中线程与并行API框架学习笔记1——线程是什么?

    前言:虽然工作了三年,但是几乎没有使用到多线程之类的内容.这其实是工作与学习的矛盾.我们在公司上班,很多时候都只是在处理业务代码,很少接触底层技术. 可是你不可能一辈子都写业务代码,而且跳槽之后新单位 ...

随机推荐

  1. @Mapper注解在springboot中无法注入

    问题① @Mapper注解报红无法注入 方法 在pom文件中添加依赖

  2. chown---改变某个文件或目录的所有者和所属的组

    chown命令改变某个文件或目录的所有者和所属的组,该命令可以向某个用户授权,使该用户变成指定文件的所有者或者改变文件所属的组.用户可以是用户或者是用户D,用户组可以是组名或组id.文件名可以使由空格 ...

  3. WPF中Image控件的Source属性

    原文:WPF中Image控件的Source属性 imgBook 是一个Image控件,在后台代码中我想给它指定Source的属性.我先如下方式进行: Uri uri = new Uri(strImag ...

  4. DSP开发中遇到的问题 - 类指针未初始化后果

    收到RECEIVE_REQ_MSG消息时会运行以下的代码,这里由于某种原因m_receiverSlaverController的值仍为NULL,并没有指向详细的CReceiverSlaverContr ...

  5. solr 亿万级数据查询性能測试

    废话不多说,我电脑配置 i7四核cpu 8G内存 插入数据文档中有5个字段,当中有两个分词.一个int,一个date 批量插入測试一次10万循环10次总共100万用时85秒 批量插入測试一次10万循环 ...

  6. 54.nodejs nodemailer不兼容

    转自:https://blog.csdn.net/q36835109/article/details/53067917 注:由于本人使用最新版本的nodemailer不兼容,所以目前使用的是0.7.1 ...

  7. golang binarySearch

    func binarySearch(nodes []*node, word Text) (int, bool) { start := end := len(nodes) - // 特例: { // 当 ...

  8. Newtonsoft.json多版本共存

    Newtonsoft.json多版本共存 https://blog.csdn.net/dang13579/article/details/72956684 https://blog.csdn.net/ ...

  9. 通过CURL抓取页面中的图片路径并下载到本地

    1.首页是图片处理页面downpic.php <?phpfunction getImage($url,$filename="") { if($url=="" ...

  10. 【2017 Multi-University Training Contest - Team 5】Rikka with Competition

    [Link]: [Description] [Solution] 把所有人的能力从大到小排; 能力最大的肯定可能拿冠军; 然后一个一个地往后扫描; 一旦出现a[i-1]-a[i]>k; 则说明从 ...