2019-08-20 UIView transition

UIView transition 的简单使用

+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^ __nullable)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);

登录页面和应用首页切换 使用到的代码 摘抄

// 切换到页面viewController
-(void)transitionToViewController:(UIViewController *) viewController options:(UIViewAnimationOptions) options{
    UIWindow * window = UIApplication.sharedApplication.keyWindow;
    [UIView transitionWithView:window duration:1.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
        BOOL oldState = UIView.areAnimationsEnabled;
        [UIView setAnimationsEnabled:NO];
        window.rootViewController = viewController;
        [UIView setAnimationsEnabled:oldState];
    } completion:nil];
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 云无心 百度输入关键词:喜欢。用条框去做定义。否则我真的...
    云无心_Ll阅读 369评论 1 0
  • 《雨的四季》一文作者抓住春天景物的色彩、情态,调动不同的感官从听觉、视觉、嗅觉等角度描绘了春雨的美丽、娇媚,夏雨的...
    155147c138f2阅读 28,529评论 2 7