关于 iOS启动图的一些发现

来源:互联网 发布:python md5加密文件 编辑:程序博客网 时间:2024/05/21 10:27

最近看一个外文技术文章以及demo

提到一种实现,即:

自定义一个控制器R,这个控制器作为window的根控制器;

然后自定义一个控制器S,这个控制器作为启动图控制器,并且作为控制器R的子控制器;

然后自定义一个导航栏控制器(或者标签栏控制器)NB,这个控制器作为控制器R的子控制器过渡切换的目标子控制器,在这个

/*

  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 (^ __nullable)(void))animations completion:(void (^__nullable)(BOOL finished))completionNS_AVAILABLE_IOS(5_0);

>>>>>>>>>>

Transitions between two of the view controller'€™s child view controllers.

 

This method adds the second view controller'€™s view to the view hierarchy and then performs the animations defined in your animations block. After the animation completes, it removes the first view controller'€™s view from the view hierarchy.

This method is only intended to be called by an implementation of a custom container view controller. If you override this method, you must call super in your implementation.


方法中的options

typedef NS_OPTIONS(NSUInteger, UIViewAnimationOptions) {

    UIViewAnimationOptionLayoutSubviews            = 1 << 0,

    UIViewAnimationOptionAllowUserInteraction      = 1 << 1,// turn on user interaction while animating

    UIViewAnimationOptionBeginFromCurrentState     = 1 << 2,// start all views from current value, not initial value

    UIViewAnimationOptionRepeat                    = 1 << 3,// repeat animation indefinitely

    UIViewAnimationOptionAutoreverse               = 1 << 4,// if repeat, run animation back and forth

    UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,// ignore nested duration

    UIViewAnimationOptionOverrideInheritedCurve    = 1 << 6,// ignore nested curve

    UIViewAnimationOptionAllowAnimatedContent      = 1 << 7,// animate contents (applies to transitions only)

    UIViewAnimationOptionShowHideTransitionViews   = 1 << 8,// flip to/from hidden state instead of adding/removing

    UIViewAnimationOptionOverrideInheritedOptions  = 1 << 9,// do not inherit any options or animation type

    

    UIViewAnimationOptionCurveEaseInOut            = 0 <<16,// default

    UIViewAnimationOptionCurveEaseIn               = 1 <<16,

    UIViewAnimationOptionCurveEaseOut              = 2 <<16,

    UIViewAnimationOptionCurveLinear               = 3 <<16,

    

    UIViewAnimationOptionTransitionNone            = 0 <<20,// default

    UIViewAnimationOptionTransitionFlipFromLeft    = 1 <<20,

    UIViewAnimationOptionTransitionFlipFromRight   = 2 <<20,

    UIViewAnimationOptionTransitionCurlUp          = 3 <<20,

    UIViewAnimationOptionTransitionCurlDown        = 4 <<20,

    UIViewAnimationOptionTransitionCrossDissolve   = 5 <<20,

    UIViewAnimationOptionTransitionFlipFromTop     = 6 <<20,

    UIViewAnimationOptionTransitionFlipFromBottom  = 7 <<20,

} NS_ENUM_AVAILABLE_IOS(4_0);决定切换的方式



0 0