我是iOS初學者,通過Pragmatic iOS book工作,我在章節結束「挑戰」中遇到問題,我要在我的筆尖文件中顯示UIImageView
中的圖像幻燈片。使用UIImageView顯示動畫時遇到問題
我有一個模型類Recipe.h
,以及一個ViewController
和標準AppDelegate.h
文件。所有連線都正確無誤,如果我僅通過self.imageView.image = self.recipe.image
在UIImageView
中顯示一個圖像,則一切正常。但是,如果我做以下,並嘗試使用animnationImages
顯示,沒有圖像顯示出來:
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//...some code here
if(self.recipe.imageArray){
self.imageView.animationDuration = 2;
self.imageView.animationRepeatCount = 2;
self.imageView.animationImages = self.recipe.imageArray;
NSLog(@"%@", self.imageView.animationImages);
}
}
我的NSLog輸出UIImage: 0x7520d60, UIImage: 0x7522390
,我認爲self.imageView.animationImages
具有位於存儲器中的影像。但是,爲什麼圖片不顯示?
謝謝。
嘗試使用'[self.imageView startAnimating]' – rog