Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mthongvanh/256a7e05ca2b475db95a to your computer and use it in GitHub Desktop.
Save mthongvanh/256a7e05ca2b475db95a to your computer and use it in GitHub Desktop.
DynamicScrollviewResizingViewController.h
#import "DynamicScrollviewResizingViewController.h"
@interface DynamicScrollviewResizingViewController ()
@property (weak, nonatomic) IBOutlet UILabel *dynamicLabel;
@end
@implementation DynamicScrollviewResizingViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.dynamicLabel.text = [self longTextSection];
}
- (NSString *)longTextSection
{
NSDictionary *appStrings = [self appStringDictionary];
return [appStrings objectForKey:@"longString"];
}
- (NSDictionary *)appStringDictionary
{
return [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"StringsForDynamicLabel" ofType:@"plist"]];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>longString</key>
<string>//
// UIViewController.h
// UIKit
//
// Copyright (c) 2007-2014 Apple Inc. All rights reserved.
//
#import &lt;Foundation/Foundation.h&gt;
#import &lt;Foundation/NSExtensionRequestHandling.h&gt;
#import &lt;UIKit/UIKitDefines.h&gt;
#import &lt;UIKit/UIApplication.h&gt;
#import &lt;UIKit/UIStateRestoration.h&gt;
#import &lt;UIKit/UITraitCollection.h&gt;
/*
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 &amp; datasource methods, and other controller
stuff.
*/
@class UIView;
@class UINavigationItem, UIBarButtonItem, UITabBarItem;
@class UISearchDisplayController;
@class UIPopoverController;
@class UIStoryboard, UIStoryboardSegue;
@class UIScrollView;
@protocol UIViewControllerTransitionCoordinator;
typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2),
};
typedef NS_ENUM(NSInteger, UIModalPresentationStyle) {
UIModalPresentationFullScreen = 0,
UIModalPresentationPageSheet NS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationFormSheet NS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationCustom NS_ENUM_AVAILABLE_IOS(7_0),
UIModalPresentationOverFullScreen NS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationOverCurrentContext NS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationPopover NS_ENUM_AVAILABLE_IOS(8_0),
UIModalPresentationNone NS_ENUM_AVAILABLE_IOS(7_0) = -1,
};
@protocol UIContentContainer &lt;NSObject&gt;
@property (nonatomic, readonly) CGSize preferredContentSize NS_AVAILABLE_IOS(8_0);
- (void)preferredContentSizeDidChangeForChildContentContainer:(id &lt;UIContentContainer&gt;)container NS_AVAILABLE_IOS(8_0);
/*
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&apos;s view is using auto layout and the -systemLayoutSizeFittingSize: of the view
changes, -systemLayoutFittingSizeDidChangeForChildContentContainer: will be sent to the view controller&apos;s parent.
*/
- (void)systemLayoutFittingSizeDidChangeForChildContentContainer:(id &lt;UIContentContainer&gt;)container NS_AVAILABLE_IOS(8_0);
/*
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&apos;s current size, viewWillTransitionToSize:withTransitionCoordinator: will not be called.
*/
- (CGSize)sizeForChildContentContainer:(id &lt;UIContentContainer&gt;)container withParentContainerSize:(CGSize)parentSize NS_AVAILABLE_IOS(8_0);
/*
This method is called when the view controller&apos;s view&apos;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 &lt;UIViewControllerTransitionCoordinator&gt;)coordinator NS_AVAILABLE_IOS(8_0);
/*
This method is called when the view controller&apos;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 &lt;UIViewControllerTransitionCoordinator&gt;)coordinator NS_AVAILABLE_IOS(8_0);
@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&apos;s object will be the view controller that caused the change.
UIKIT_EXTERN NSString *const UIViewControllerShowDetailTargetDidChangeNotification NS_AVAILABLE_IOS(8_0);
NS_CLASS_AVAILABLE_IOS(2_0) @interface UIViewController : UIResponder &lt;NSCoding, UIAppearanceContainer, UITraitEnvironment, UIContentContainer&gt; {
@package
UIView *_view;
UITabBarItem *_tabBarItem;
UINavigationItem *_navigationItem;
NSArray *_toolbarItems;
NSString *_title;
NSString *_nibName;
NSBundle *_nibBundle;
UIViewController *_parentViewController; // Nonretained
UIViewController *_childModalViewController;
UIViewController *_parentModalViewController; // Nonretained
UIViewController *_previousRootViewController; // Nonretained
UIView *_modalTransitionView;
UIResponder *_modalPreservedFirstResponder;
id _dimmingView;
id _dropShadowView;
id _currentAction;
UIStoryboard *_storyboard;
NSArray *_storyboardSegueTemplates;
NSDictionary *_externalObjectsTableForViewLoading;
NSArray *_topLevelObjectsToKeepAliveFromStoryboard;
UIView *_savedHeaderSuperview;
UIView *_savedFooterSuperview;
UIBarButtonItem *_editButtonItem;
UISearchDisplayController *_searchDisplayController;
UIModalTransitionStyle _modalTransitionStyle;
UIModalPresentationStyle _modalPresentationStyle;
UIInterfaceOrientation _lastKnownInterfaceOrientation;
UIPopoverController* _popoverController;
UIView *_containerViewInSheet;
CGSize _contentSizeForViewInPopover;
CGSize _formSheetSize;
UIScrollView *_recordedContentScrollView;
void (^_afterAppearance)(void);
NSInteger _explicitAppearanceTransitionLevel;
NSArray *_keyCommands;
NSMapTable *_overrideTraitCollections;
struct {
unsigned int appearState:2;
unsigned int isEditing:1;
unsigned int isPerformingModalTransition:1;
unsigned int hidesBottomBarWhenPushed:1;
unsigned int autoresizesArchivedViewToFullSize:1;
unsigned int viewLoadedFromControllerNib:1;
unsigned int isRootViewController:1;
unsigned int customizesForPresentationInPopover:1;
unsigned int isSuspended:1;
unsigned int wasApplicationFrameAtSuspend:1;
unsigned int wantsFullScreenLayout:1;
unsigned int shouldUseFullScreenLayout:1;
unsigned int allowsAutorotation:1;
unsigned int searchControllerRetained:1;
unsigned int oldModalInPopover:1;
unsigned int isModalInPopover:1;
unsigned int isInWillRotateCallback:1;
unsigned int disallowMixedOrientationPresentations:1;
unsigned int isFinishingModalTransition:1;
unsigned int definesPresentationContext:1;
unsigned int providesPresentationContextTransitionStyle:1;
unsigned int containmentSupport:1;
unsigned int isSettingAppearState:1;
unsigned int isInAnimatedVCTransition:1;
unsigned int presentationIsChanging:1;
unsigned int isBeingPresented:1;
unsigned int containmentIsChanging:1;
unsigned int explicitTransitionIsAppearing:1;
unsigned int disableAppearanceTransitions:1;
unsigned int needsDidMoveCleanup:1;
unsigned int suppressesBottomBar:1;
unsigned int disableRootPromotion:1;
unsigned int interfaceOrientationReentranceGuard:1;
unsigned int isExecutingAfterAppearance:1;
unsigned int rootResignationNeeded:1;
unsigned int shouldSynthesizeSupportedOrientations:1;
unsigned int viewConstraintsNeedUpdateOnAppearance:1;
unsigned int shouldForceNonAnimatedTransition:1;
unsigned int isInCustomTransition:1;
unsigned int usesSharedView:1;
unsigned int extendedLayoutIncludesOpaqueBars:1;
unsigned int automaticallyAdjustInsets:1;
unsigned int previousShouldUnderlapUnderStatusBar:1;
unsigned int freezeShouldUnderlapUnderStatusBar:1;
unsigned int neverResizeRoot:1;
unsigned int monitorsSystemLayoutFittingSize:1;
} _viewControllerFlags;
}
/*
The designated initializer. If you subclass UIViewController, you must call the super implementation of this
method, even if you aren&apos;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&apos;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&apos; -loadView method will attempt to load a NIB whose
name is the same as your view controller&apos;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;
@property(nonatomic,retain) UIView *view; // The getter first invokes [self loadView] if the view hasn&apos;t been set yet. Subclasses must call super if they override the setter or getter.
- (void)loadView; // This is where subclasses should create their custom view hierarchy if they aren&apos;t using a nib. Should never be called directly.
- (void)viewWillUnload NS_DEPRECATED_IOS(5_0,6_0);
- (void)viewDidUnload NS_DEPRECATED_IOS(3_0,6_0); // Called after the view controller&apos;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.
- (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.
- (BOOL)isViewLoaded NS_AVAILABLE_IOS(3_0);
@property(nonatomic, readonly, copy) NSString *nibName; // The name of the nib to be loaded to instantiate the view.
@property(nonatomic, readonly, retain) NSBundle *nibBundle; // The bundle from which to load the nib.
@property(nonatomic, readonly, retain) UIStoryboard *storyboard NS_AVAILABLE_IOS(5_0);
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender NS_AVAILABLE_IOS(5_0);
- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender NS_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.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender NS_AVAILABLE_IOS(5_0);
// 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(6_0);
// 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&apos;s implementation should be returned.
- (UIViewController *)viewControllerForUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender NS_AVAILABLE_IOS(6_0);
// 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 NS_AVAILABLE_IOS(6_0);
- (void)viewWillAppear:(BOOL)animated; // Called when the view is about to made visible. Default does nothing
- (void)viewDidAppear:(BOOL)animated; // Called when the view has been fully transitioned onto the screen. Default does nothing
- (void)viewWillDisappear:(BOOL)animated; // Called when the view is dismissed, covered or otherwise hidden. Default does nothing
- (void)viewDidDisappear:(BOOL)animated; // Called after the view was dismissed, covered or otherwise hidden. Default does nothing
// Called just before the view controller&apos;s view&apos;s layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
- (void)viewWillLayoutSubviews NS_AVAILABLE_IOS(5_0);
// Called just after the view controller&apos;s view&apos;s layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
- (void)viewDidLayoutSubviews NS_AVAILABLE_IOS(5_0);
@property(nonatomic,copy) NSString *title; // Localized title for use by a parent controller.
- (void)didReceiveMemoryWarning; // Called when the parent application receives a memory warning. On iOS 6.0 it will no longer clear the view by default.
/*
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;
// This property has been replaced by presentedViewController.
@property(nonatomic,readonly) UIViewController *modalViewController NS_DEPRECATED_IOS(2_0, 6_0);
// The view controller that was presented by this view controller or its nearest ancestor.
@property(nonatomic,readonly) UIViewController *presentedViewController NS_AVAILABLE_IOS(5_0);
// The view controller that presented this view controller (or its farthest ancestor.)
@property(nonatomic,readonly) UIViewController *presentingViewController NS_AVAILABLE_IOS(5_0);
/*
Determines which parent view controller&apos;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(5_0);
// A controller that defines the presentation context can also specify the modal transition style if this property is true.
@property(nonatomic,assign) BOOL providesPresentationContextTransitionStyle NS_AVAILABLE_IOS(5_0);
/*
These four methods can be used in a view controller&apos;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)isBeingPresented NS_AVAILABLE_IOS(5_0);
- (BOOL)isBeingDismissed NS_AVAILABLE_IOS(5_0);
- (BOOL)isMovingToParentViewController NS_AVAILABLE_IOS(5_0);
- (BOOL)isMovingFromParentViewController NS_AVAILABLE_IOS(5_0);
/*
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(5_0);
// The completion handler, if provided, will be invoked after the dismissed controller&apos;s viewDidDisappear: callback is invoked.
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_AVAILABLE_IOS(5_0);
// 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)animated NS_DEPRECATED_IOS(2_0, 6_0);
// Dismiss the current modal child. Uses a vertical sheet transition if animated. This method has been replaced by dismissViewControllerAnimated:completion:
- (void)dismissModalViewControllerAnimated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);
/*
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 modalTransitionStyle NS_AVAILABLE_IOS(3_0);
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2);
// This controls whether this view controller takes over control of the status bar&apos;s appearance when presented non-full screen on another view controller. Defaults to NO.
@property(nonatomic,assign) BOOL modalPresentationCapturesStatusBarAppearance NS_AVAILABLE_IOS(7_0);
// Presentation modes may keep the keyboard visible when not required. Default implementation affects UIModalPresentationFormSheet visibility.
- (BOOL)disablesAutomaticKeyboardDismissal NS_AVAILABLE_IOS(4_3);
@property(nonatomic,assign) BOOL wantsFullScreenLayout NS_DEPRECATED_IOS(3_0, 7_0); // Deprecated in 7_0, Replaced by the following:
@property(nonatomic,assign) UIRectEdge edgesForExtendedLayout NS_AVAILABLE_IOS(7_0); // Defaults to UIRectEdgeAll
@property(nonatomic,assign) BOOL extendedLayoutIncludesOpaqueBars NS_AVAILABLE_IOS(7_0); // Defaults to NO, but bars are translucent by default on 7_0.
@property(nonatomic,assign) BOOL automaticallyAdjustsScrollViewInsets NS_AVAILABLE_IOS(7_0); // Defaults to YES
/* The preferredContentSize is used for any container laying out a child view controller.
*/
@property (nonatomic) CGSize preferredContentSize NS_AVAILABLE_IOS(7_0);
// 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 NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO
// 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 NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarAnimationFade
// This should be called whenever the return values for the view controller&apos;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)setNeedsStatusBarAppearanceUpdate NS_AVAILABLE_IOS(7_0);
/* 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)sender NS_AVAILABLE_IOS(8_0);
/* This method will show a view controller appropriately for the current size-class environment. It&apos;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)sender NS_AVAILABLE_IOS(8_0);
/* This method will show a view controller within the semantic &quot;detail&quot; UI associated with the current size-class environment. It&apos;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)sender NS_AVAILABLE_IOS(8_0);
@end
// To make it more convenient for applications to adopt rotation, a view controller may implement the below methods. Your UIWindow&apos;s frame should use [UIScreen mainScreen].bounds as its frame.
@interface UIViewController (UIViewControllerRotation)
// 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)attemptRotationToDeviceOrientation NS_AVAILABLE_IOS(5_0);
// Applications should use supportedInterfaceOrientations and/or shouldAutorotate..
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 6_0);
// New Autorotation support.
- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);
- (NSUInteger)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation NS_AVAILABLE_IOS(6_0);
// The rotating header and footer views will slide out during the rotation and back in once it has completed.
- (UIView *)rotatingHeaderView NS_DEPRECATED_IOS(2_0,8_0, &quot;Header views are animated along with the rest of the view hierarchy&quot;); // Must be in the view hierarchy. Default returns nil.
- (UIView *)rotatingFooterView NS_DEPRECATED_IOS(2_0,8_0, &quot;Footer views are animated along with the rest of the view hierarchy&quot;); // Must be in the view hierarchy. Default returns nil.
@property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientation NS_DEPRECATED_IOS(2_0,8_0);
// Notifies when rotation begins, reaches halfway point and ends.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(2_0,8_0, &quot;Implement viewWillTransitionToSize:withTransitionCoordinator: instead&quot;);
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation NS_DEPRECATED_IOS(2_0,8_0);
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(3_0,8_0, &quot;Implement viewWillTransitionToSize:withTransitionCoordinator: instead&quot;);
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(2_0, 5_0);
- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 5_0); // The rotating header and footer views are offscreen.
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(2_0, 5_0); // A this point, our view orientation is set to the new orientation.
@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)
@property(nonatomic,getter=isEditing) BOOL editing;
- (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.
- (UIBarButtonItem *)editButtonItem; // Return an Edit|Done button that can be used as a navigation item&apos;s custom view. Default action toggles the editing state with animation.
@end
@interface UIViewController (UISearchDisplayControllerSupport)
@property(nonatomic, readonly, retain) UISearchDisplayController *searchDisplayController NS_DEPRECATED_IOS(3_0,8_0);
@end
/*
This exception is raised when a child view controller&apos;s view is added into the view hierarchy and the first
superview of the child view controller&apos;s view that has a view controller is NOT the child view controller&apos;s
parent.
*/
UIKIT_EXTERN NSString *const UIViewControllerHierarchyInconsistencyException NS_AVAILABLE_IOS(5_0);
/*
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)
// An array of children view controllers. This array does not include any presented view controllers.
@property(nonatomic,readonly) NSArray *childViewControllers NS_AVAILABLE_IOS(5_0);
/*
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 *)childController NS_AVAILABLE_IOS(5_0);
/*
Removes the the receiver from its parent&apos;s children controllers array. If this method is overridden then
the super implementation must be called.
*/
- (void) removeFromParentViewController NS_AVAILABLE_IOS(5_0);
/*
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&apos;s view to the superview of the
fromViewController&apos;s view and the fromViewController&apos;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&apos;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&apos;s view is added
to the visible view hierarchy while the fromViewController&apos;s view is removed.
*/
- (void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(5_0);
// 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);
- (void)endAppearanceTransition __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
// Override to return a child view controller or nil. If non-nil, that view controller&apos;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 NS_AVAILABLE_IOS(7_0);
- (UIViewController *)childViewControllerForStatusBarHidden NS_AVAILABLE_IOS(7_0);
// Call to modify the trait collection for child view controllers.
- (void)setOverrideTraitCollection:(UITraitCollection *)collection forChildViewController:(UIViewController *)childViewController NS_AVAILABLE_IOS(8_0);
- (UITraitCollection *)overrideTraitCollectionForChildViewController:(UIViewController *)childViewController NS_AVAILABLE_IOS(8_0);
@end
@interface UIViewController (UIContainerViewControllerCallbacks)
/*
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)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers NS_DEPRECATED_IOS(5_0,6_0);
- (BOOL)shouldAutomaticallyForwardRotationMethods NS_DEPRECATED_IOS(6_0,8_0, &quot;Manually forward viewWillTransitionToSize:withTransitionCoordinator: if necessary&quot;);
- (BOOL)shouldAutomaticallyForwardAppearanceMethods NS_AVAILABLE_IOS(6_0);
/*
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&apos;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 *)parent NS_AVAILABLE_IOS(5_0);
- (void)didMoveToParentViewController:(UIViewController *)parent NS_AVAILABLE_IOS(5_0);
@end
@interface UIViewController (UIStateRestoration) &lt;UIStateRestoring&gt;
@property (nonatomic, copy) NSString *restorationIdentifier NS_AVAILABLE_IOS(6_0);
@property (nonatomic, readwrite, assign) Class&lt;UIViewControllerRestoration&gt; restorationClass NS_AVAILABLE_IOS(6_0);
- (void) encodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
- (void) decodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
- (void) applicationFinishedRestoringState NS_AVAILABLE_IOS(7_0);
@end
@interface UIViewController (UIConstraintBasedLayoutCoreMethods)
/* 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)updateViewConstraints NS_AVAILABLE_IOS(6_0);
@end
@protocol UIViewControllerTransitioningDelegate;
@interface UIViewController(UIViewControllerTransitioning)
@property (nonatomic,assign) id &lt;UIViewControllerTransitioningDelegate&gt; transitioningDelegate NS_AVAILABLE_IOS(7_0);
@end
@interface UIViewController (UILayoutSupport)
// These objects may be used as layout items in the NSLayoutConstraint API
@property(nonatomic,readonly,retain) id&lt;UILayoutSupport&gt; topLayoutGuide NS_AVAILABLE_IOS(7_0);
@property(nonatomic,readonly,retain) id&lt;UILayoutSupport&gt; bottomLayoutGuide NS_AVAILABLE_IOS(7_0);
@end
@class NSExtensionContext;
@interface UIViewController(NSExtensionAdditions) &lt;NSExtensionRequestHandling&gt;
// 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 *extensionContext NS_AVAILABLE_IOS(8_0);
@end
@class UIPresentationController, UIPopoverPresentationController;
@interface UIViewController (UIAdaptivePresentations)
@property (nonatomic,readonly) UIPresentationController *presentationController NS_AVAILABLE_IOS(8_0);
@property (nonatomic,readonly) UIPopoverPresentationController *popoverPresentationController NS_AVAILABLE_IOS(8_0);
@end
</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment