我不知道如何制作动画,或者我会如何将它放入Xcode。有人可以给我一些关于这方面的背景资料吗?如何将动画添加到Xcode中?
-2
A
回答
5
NSArray *animationArray = [NSArray arrayWithObjects:[UIImage [email protected]"firstImage",[UIImage [email protected]"secondImage",nil]; //add as many as you want
现在你需要一个imageview的设置动画:
self.myImageView.animationImages =animationArray;
self.myImageView.animationDuration = 3;
self.myImageView.animationRepeatCount = -1; //keeps going infinitely
[self.myImageView startAnimating];
0
我猜你想要做的是创建一个动画图像,而不是动画化一个视图过渡...这里有两个创建iOS动画的方法背景。
第一个选项:创建图像数组(UIImage),然后使用startAnimating方法。 事情是这样的:
imageView.image = yourLastImage;
// Do this first so that after the animation is complete the image view till show your last image.
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
nil];
// Note: here you may instead want to use something like [UIImage imageWithContentsOfFile:[self localImagePath:NO]] instead depending upon your targeted iOS version.
UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame:
CGRectMake(100, 125, 150, 130)];
animatedImageView.animationImages = imageArray;
animatedImageView.animationDuration = 1.1;
myAnimation.animationRepeatCount = 1;
animatedImageView.contentMode = UIViewContentModeBottomLeft;
[self.view addSubview:animatedImageView];
[animatedImageView startAnimating];
第二个选项:(适用于iOS 4及更高版本)可以使用基于块的方法。这里是一个指向StackOverflow的参考文章的链接。
What are block-based animation methods in iPhone OS 4.0?
你也可能想看看,苹果提供与核心动画文件:
相关问题
- 1. 将Flash动画添加到Xcode?
- 2. 如何将动画添加到UITextField?
- 3. 如何将动画添加到DialogFragment?
- 4. 如何将IOKit.framework添加到xcode 6.2中
- 5. 将动画添加到ajax中
- 6. 将动画添加到Android的SnackBar中
- 7. 如何将Alamofire手动添加到xcode项目中
- 8. 如何手动添加库到Xcode
- 9. 如何将库添加到xcode
- 10. 如何将UIKit添加到Xcode项目?
- 11. 如何成功将RealmSwift添加到Xcode?
- 12. 如何将libclang添加到xcode?
- 13. 如何将RAC库添加到XCode?
- 14. 将缩小动画添加到活动
- 15. 将动画添加到新活动
- 16. 将音乐添加到Java中带有动画的动画
- 17. 将动画添加到动画中的最终广场
- 18. 如何在viewDidAppear中将动画添加到UIView?
- 19. 如何将aceleration添加到此jQuery动画中?
- 20. 如何将swift动画添加到图像中?
- 21. 如何将动画添加到rubymotion应用程序中?
- 22. 如何将Flash动画添加到视频/电影文件中?
- 23. 将活动添加到日历xcode?
- 24. 如何将加载动画添加到ActiveAdmin
- 25. 如何添加文字动画到wordpress
- 26. 如何“动画”添加行到JTable
- 27. 如何添加动画到这个jQuery?
- 28. 如何添加easing到这个动画
- 29. Android:如何将画布添加到FrameLayout?
- 30. GWT - 如何将keyboardlistener添加到画布?
http://stackoverflow.com.tw m/questions/630265/iphone-uiview-animation-best-practice –
尝试使用Google。 “Xcode动画”。有很多关于它的信息。 –
http://www.apeth.com/iOSBook/ch17.html – matt