我在我所採取的ImageView作爲背景,並在ImageView的我使用89個圖像作出animation.Here是我的代碼做動畫Ipad的動畫圖像崩潰問題
-(void)viewWillAppear:(BOOL)animated
{
NSString *cachesDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSLog(@"cachesDirectoryPath: %@", cachesDirectoryPath);
CPIAppDelegate *obj=(CPIAppDelegate *)[[UIApplication sharedApplication]delegate];
arrayOfImages=[[NSMutableArray alloc]init];
viewMenu.hidden = obj.buttonStatus;
for (int i=0; i<IMAGE_ANIMATION_COUNT; i++) {
// [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/streamvideo351_frame%d.jpg",cachesDirectoryPath,i]];
[arrayOfImages addObject:[UIImage imageNamed:[NSString stringWithFormat:@"streamvideo351_frame%d.jpg",i]]];
}
BackGrdImage.animationImages=arrayOfImages;
BackGrdImage.animationDuration =5.0;
BackGrdImage.animationRepeatCount =3;
[BackGrdImage startAnimating];
[arrayOfImages removeAllObjects];
}
和應用在dealloc方法中我使用
[imageAnimations release];
[BackGrdImage removeFromSuperview];
[BackGrdImage release];
它正常工作模擬器上的崩潰,但在Ipad.What在ipad上實際發生的是有時它會閃爍,一段時間一次disappear.So請幫我出這個friends.I我也在-(void)viewWillDisappear
上發佈了這個數組e朋友幫助我與它任何幫助或建議將不勝感激。
可能不是問題,但請確保您在viewWillAppear:方法的某個時刻調用[super viewWillAppear:animated]。 – Sam 2011-04-27 06:31:11