我不知道如何製作動畫,或者我會如何將它放入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