iOS程序是基于MVC设计模式的,UIViewController是Controller的基类,一般我们通过继承这个类来实现自己的Controller,框架为我们提供了一些定义好的子类,如UINavigationController,UITabbarController
Creating a View Controller Using Nib Files
– initWithNibName:bundle:-
nibNameproperty -
nibBundleproperty
Using a Storyboard
– shouldPerformSegueWithIdentifier:sender:– performSegueWithIdentifier:sender:– prepareForSegue:sender:-
storyboardproperty – canPerformUnwindSegueAction:fromViewController:withSender:
Managing the View
-
viewproperty – isViewLoaded– loadView– viewDidLoad-
titleproperty – viewDidUnloadDeprecated in iOS 6.0– viewWillUnloadDeprecated in iOS 6.0
Handling Memory Warnings
Responding to View Events
– viewWillAppear:– viewDidAppear:– viewWillDisappear:– viewDidDisappear:– viewWillLayoutSubviews– viewDidLayoutSubviews
Testing for Specific Kinds of View Transitions
– isMovingFromParentViewController– isMovingToParentViewController– isBeingPresented– isBeingDismissed
Configuring the View’s Layout Behavior
Configuring the View Rotation Settings
– shouldAutorotate– supportedInterfaceOrientations– preferredInterfaceOrientationForPresentation-
interfaceOrientationproperty + attemptRotationToDeviceOrientation– rotatingHeaderView– rotatingFooterView– shouldAutorotateToInterfaceOrientation:Deprecated in iOS 6.0
Responding to View Rotation Events
– willRotateToInterfaceOrientation:duration:– willAnimateRotationToInterfaceOrientation:duration:– didRotateFromInterfaceOrientation:– didAnimateFirstHalfOfRotationToInterfaceOrientation:Deprecated in iOS 5.0– willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:Deprecated in iOS 5.0– willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:Deprecated in iOS 5.0
Responding to Containment Events
Adding Editing Behaviors to Your View Controller
-
editingproperty – setEditing:animated:
Managing State Restoration
-
restorationIdentifierproperty -
restorationClassproperty – encodeRestorableStateWithCoder:– decodeRestorableStateWithCoder:
Presenting Another View Controller’s Content
– presentViewController:animated:completion:– dismissViewControllerAnimated:completion:-
modalTransitionStyleproperty -
modalPresentationStyleproperty -
definesPresentationContextproperty -
providesPresentationContextTransitionStyleproperty – disablesAutomaticKeyboardDismissal– dismissModalViewControllerAnimated:Deprecated in iOS 6.0– presentModalViewController:animated:Deprecated in iOS 6.0
Getting Other Related View Controllers
-
presentingViewControllerproperty -
presentedViewControllerproperty -
parentViewControllerproperty -
navigationControllerproperty -
splitViewControllerproperty -
tabBarControllerproperty -
searchDisplayControllerproperty -
modalViewControllerproperty Deprecated in iOS 6.0
Managing Child View Controllers in a Custom Container
-
childViewControllersproperty – addChildViewController:– removeFromParentViewController– shouldAutomaticallyForwardRotationMethods– shouldAutomaticallyForwardAppearanceMethods– transitionFromViewController:toViewController:duration:options:animations:completion:– beginAppearanceTransition:animated:– endAppearanceTransition– viewControllerForUnwindSegueAction:fromViewController:withSender:– segueForUnwindingToViewController:fromViewController:identifier:– automaticallyForwardAppearanceAndRotationMethodsToChildViewControllersDeprecated in iOS 6.0
Configuring a Navigation Interface
-
navigationItemproperty – editButtonItem-
hidesBottomBarWhenPushedproperty – setToolbarItems:animated:-
toolbarItemsproperty
Configuring Tab Bar Items
-
tabBarItemproperty
Configuring Display in a Popover Controller
-
contentSizeForViewInPopoverproperty -
modalInPopoverproperty