简体   繁体   English

iPhone中的动画

[英]animation in iphone

I am looking for some reference about the animation such that when you click on the application, it will bring you the first screen but slowly. 我正在寻找有关动画的参考,以便在您单击该应用程序时,它将为您带来第一个屏幕,但速度却很慢。

Does anybody know what it is please advice me on this issue. 有人知道这是什么吗,请给我建议。 Thanks 谢谢

edit I just wanna make a nice transition after all.Whenever I click on the application, the first screen just come up. 编辑毕竟,我只是想进行一个很好的过渡。每当我单击该应用程序时,就会出现第一个屏幕。 I would like to make it nicer just like the first screen is brought slowly slowly and displayed on the scree. 我想使它变得更好,就像将第一个屏幕缓慢缓慢地放到屏幕上一样。 Hope it makes sense now. 希望现在有意义。

Well, this is a broad question, but I think you can try Cocos2D for this. 好吧,这是一个广泛的问题,但是我认为您可以为此尝试Cocos2D。 There are a lot of examples how to use it, but one simple animation example is this: http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d 有很多使用它的示例,但是一个简单的动画示例是这样的: http : //www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

Also, there is a good book called "Learning Cocos2D" where there is a good example of managing menus and load layers. 此外,还有一本名为“ Learning Cocos2D”的好书,其中有一个管理菜单和加载层的好例子。 http://cocos2dbook.com/ http://cocos2dbook.com/

I hope I could help. 希望我能帮上忙。

UIView has a lot methods for animating them. UIView有很多动画方法。 Take a look at the View Programming Guide: 看一下《 View编程指南》:

http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html#//apple_ref/doc/uid/TP40009503-CH6-SW1 http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html#//apple_ref/doc/uid/TP40009503-CH6-SW1

The UIView documentation also has a chapter that lists the animation related methods: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW131 UIView文档也有一章列出了与动画相关的方法: http : //developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid / TP40006816-CH3-SW131

And here's an example for a block based animation, which will fade in a view using it's alpha value: 这是一个基于块的动画的示例,该动画将使用其alpha值在视图中淡出:

NSTimeInterval animationDuration = 0.3;
CGFloat startValue = 0.0;
CGFloat endValue = 1.0;

myView.alpha = startValue;

[UIView animateWithDuration:animationDuration delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
                myView.alpha = endValue
    }
                     completion:^(BOOL finished){
                          // If you need to do something additional once the animation is finished, place it here.
                     }];

I assume you mean fading out the splash screen after the application starts? 我认为您的意思是在应用程序启动后淡出初始屏幕? You can add something like this to applicationDidFinishLaunching to display the splash art full-screen immediately on boot, and then fade it out 您可以在applicationDidFinishLaunching中添加类似内容,以在启动时立即全屏显示启动画面,然后将其淡出

UIView *topView = self.window.rootViewController.view;
bootSplashView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
bootSplashView.image = [UIImage imageNamed:@"iPhoneDefault.png"];
[topView addSubview:bootSplashView];
[self performSelector:@selector(fadeBootScreen) withObject:nil afterDelay:0];

And then in a separate method: 然后使用另一种方法:

- (void)fadeBootScreen
{
    [UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationCurveEaseIn animations:^{
        bootSplashView.alpha = 0.0;
    } completion:^(BOOL finished) {
        [bootSplashView removeFromSuperview];
        bootSplashView = nil;
    }];
}

Make sure to add 'bootSplashView' as an class variable. 确保将“ bootSplashView”添加为类变量。 If your app can start in different orientation (relevant on the iPad), specialize for those cases by loading a different image. 如果您的应用可以以不同的方向(在iPad上相关)启动,请通过加载其他图像来专门处理这些情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM