美文网首页
2019-08-20 UIView transition

2019-08-20 UIView transition

作者: 犯色戒的和尚 | 来源:发表于2019-08-20 17:32 被阅读0次

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];
}

相关文章

网友评论

      本文标题:2019-08-20 UIView transition

      本文链接:https://www.haomeiwen.com/subject/hgtmsctx.html