2015-08-14 71 views
-1

我想在0.7秒後動畫圖像,但他們不工作,他們不顯示我的視圖上的圖像。圖像動畫無效

NSMutableArray *images = [[NSMutableArray alloc] init]; 
[images addObject:[UIImage imageNamed:@"L1.png"]]; 
[images addObject:[UIImage imageNamed:@"L2.png"]]; 
[images addObject:[UIImage imageNamed:@"L3.png"]]; 
[images addObject:[UIImage imageNamed:@"L4.png"]]; 
[images addObject:[UIImage imageNamed:@"L5.png"]]; 
[images addObject:[UIImage imageNamed:@"L6.png"]]; 
[images addObject:[UIImage imageNamed:@"L7.png"]]; 
[images addObject:[UIImage imageNamed:@"L8.png"]]; 
[images addObject:[UIImage imageNamed:@"L9.png"]]; 
[images addObject:[UIImage imageNamed:@"L10.png"]]; 
[images addObject:[UIImage imageNamed:@"L11.png"]]; 
[images addObject:[UIImage imageNamed:@"L12.png"]]; 
self.imagsd.animationImages=images; 
self.imagsd.animationDuration=0.7; 
+1

您是否已驗證'self.imagsd'不是'nil'並且它具有適當的框架? – rmaddy

+0

是的,它是在我的視圖 –

回答

1

您需要在圖像視圖中致電startAnimating

+0

我們如何調用.... –

+0

'[self.imagsd startAnimating];' –

+0

認爲蒂姆工作 –

0
// Load images 



NSMutableArray *images = [[NSMutableArray alloc] init]; 
[images addObject:[UIImage imageNamed:@"L1.png"]]; 
[images addObject:[UIImage imageNamed:@"L2.png"]]; 
[images addObject:[UIImage imageNamed:@"L3.png"]]; 
[images addObject:[UIImage imageNamed:@"L4.png"]]; 
[images addObject:[UIImage imageNamed:@"L5.png"]]; 
[images addObject:[UIImage imageNamed:@"L6.png"]]; 
[images addObject:[UIImage imageNamed:@"L7.png"]]; 
[images addObject:[UIImage imageNamed:@"L8.png"]]; 
[images addObject:[UIImage imageNamed:@"L9.png"]]; 
[images addObject:[UIImage imageNamed:@"L10.png"]]; 
[images addObject:[UIImage imageNamed:@"L11.png"]]; 
[images addObject:[UIImage imageNamed:@"L12.png"]]; 

// Normal Animation 
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 95, 86, 193)]; 
animationImageView.animationImages = images; 
animationImageView.animationDuration = 0.5; 

[self.view addSubview:animationImageView]; 
[animationImageView startAnimating];