我想翻转我的应用程序的启动画面 - 如何模仿翻页动画,如打开书的封面? [英] I would like to flip my app's splash screen - how can I mimic the flip animation like opening of the cover page of a book?

查看:123
本文介绍了我想翻转我的应用程序的启动画面 - 如何模仿翻页动画,如打开书的封面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Iphone应用程序,其中我想在我的splashview中实现flipanimation,就像在PATH Application中一样。我使用seperte viewcontroller来呈现我的splashview。我想用这个动画从窗口中删除它。可以任何人都知道如何实现这一点。这就是我正在做的添加视图。如何从窗口中删除此视图并添加带有动画的新视图`

I have an Iphone application in which i want to implement a flipanimation in my splashview,as did in the PATH Application.I am using a seperte viewcontroller to present my splashview.I want to remove it from window with this animation.Can anybody have any idea about how to achieve this.this is what i am doing to add the view.How i can remove this view from the window and add newview with an animation like`

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    self.startupController = [[StartupViewController alloc] initWithNibName:@"StartupViewController" bundle:nil];
    [window addSubview:self.startupController.view];
    [self.startupController.activityIndicator setHidden:NO];
    [self.startupController.activityIndicator startAnimating];
    [window makeKeyAndVisible];

    timer = [NSTimer scheduledTimerWithTimeInterval: 2.0
                                                 target: self
                                               selector: @selector(handleTimer:)
                                               userInfo: nil
                                                repeats: NO];


    // [window addSubview:navigationController.view];
    //  [window makeKeyAndVisible];

    return YES;
}

-(void)handleTimer:(NSTimer*)timer {


    [self.startupController.activityIndicator stopAnimating];
    [self.startupController.activityIndicator setHidden:YES];

    self.startupController.view.layer.anchorPoint=CGPointMake(0, .5);
    self.startupController.view.center = CGPointMake(self.startupController.view.center.x - self.startupController.view.bounds.size.width/2.0f, self.startupController.view.center.y);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:5];
    [UIView setAnimationDelay:1];
    self.startupController.view.transform = CGAffineTransformMakeTranslation(0,0);
    CATransform3D _3Dt = CATransform3DIdentity;
    _3Dt =CATransform3DMakeRotation(3.141f/2.0f,0.0f,-1.0f,0.0f);
    _3Dt.m34 = 0.001f;
    _3Dt.m14 = -0.0015f;
    self.startupController.view.layer.transform =_3Dt;
    [UIView commitAnimations];  
    //[window addSubview:navigationController.view];
     //[window makeKeyAndVisible];      
}

`when i am doing like this i can have that flip animation.but when the view is flipping i need to have my home view there.But when i am uncomenting the last two lines that functionality is working but there is no animation.Can anybody help me?


推荐答案

这是我已用过的一个代码我的项目。

Here is one code which i have already used in one of my project.

我要求打开封面就像一个打击垫。

There i have requirement of opening cover page like a pad.

#pragma mark Open Book Animation

- (void)pageOpenView:(UIView *)viewToOpen duration:(NSTimeInterval)duration {

  // first add next view below current view
  [self.view.window insertSubview:navigationController.view 
                     belowSubview:self.view];

  // set anchor point for the view animation
  viewToOpen.layer.anchorPoint = CGPointMake(0.0f, 0.0f);

  viewToOpen.center = CGPointMake(0, 
                                  (viewToOpen.center.y - 
                                   (viewToOpen.bounds.size.height/2.0f)));

  // start the Page Open
  [UIView beginAnimations:@"Page Open" context:nil];
  [UIView setAnimationDuration:2.0];
  [UIView setAnimationDelegate:self];
  [UIView setAnimationDidStopSelector:@selector(didEndAnimation)];

  [viewToOpen.layer setValue:[NSNumber numberWithInt:180] 
                  forKeyPath:@"transform.rotation.x"];

  [splashImageView setHidden:YES];

  [UIView commitAnimations];

}

这里viewToOpen是需要动画的UIView,以及持续时间是动画的时间线。

Here viewToOpen is the UIView for which animation is required, and duration is the time line for animation.

希望这是你所需要的。

享受编码:)

这篇关于我想翻转我的应用程序的启动画面 - 如何模仿翻页动画,如打开书的封面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆