【问题标题】:Creating a custom View Controller Animation创建自定义视图控制器动画
【发布时间】:2014-02-20 05:12:30
【问题描述】:

我正在尝试创建一个视图控制器动画,其中用户当前在屏幕上的视图控制器向下滑动,在下面显示新的视图控制器。所以新的视图控制器会像背景一样,新的视图控制器会向下滑动并显示它。我试了一下,但没有成功。你会如何建议这样做?

这是我尝试过的:

-(void)showLogout:(UIButton *)sender {

    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"TermsAccepted"];

    WelcomeViewController *welcomeViewController = [[WelcomeViewController alloc] init];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    self.view.frame = CGRectMake(0, 1200, 320, 568);
    [self.navigationController pushViewController:welcomeViewController animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES];
    [UIView commitAnimations];

}

【问题讨论】:

    标签: ios animation uiviewcontroller


    【解决方案1】:

    试试这个

    -(void)showLogout:(UIButton *)sender {
    
        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"TermsAccepted"];
    
        WelcomeViewController *welcomeViewController = [[WelcomeViewController alloc] init];
    
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1];
     [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController cache:YES];
    
        self.view.frame = CGRectMake(0, 1200, 320, 568);
        [self.navigationController pushViewController:welcomeViewController animated:NO];
        [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES];
        [UIView commitAnimations];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 2017-03-26
      • 1970-01-01
      • 1970-01-01
      • 2015-12-19
      相关资源
      最近更新 更多