我做了簡單的動畫,但要動畫添加到圖像像從左至右像滑塊一樣,我有圖片,如何編程製作動畫的陣列,動畫圖像向左像幻燈片
-(void) slideImages
{
NSMutableArray *imagesArrays= [[NSMutableArray alloc]init];
for (SliderDC *slider in imagesArray) {
sliderImageName = slider.sliderImagePath;
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString: [NSString stringWithFormat:@"%@%@",KWURL ,sliderImageName]]];
UIImage *imgOne = [UIImage imageWithData:imageData];
if(imgOne)
[imagesArrays addObject:imgOne];
}
// after adding all image in array then add animation.
UIImageView* animatedImageView;
if ([[UIScreen mainScreen] bounds].size.height == 568){
animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 65, 320, 150)];
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 98, 768, 228)];
}
else
{
animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 65, 320, 118)];
}
animatedImageView.animationImages = imagesArrays;
animatedImageView.animationDuration = 20.0f;
animatedImageView.animationRepeatCount = 0;
[self.view addSubview: animatedImageView];
[animatedImageView startAnimating];
}
在創建新圖像的動畫時,這不顯示黑屏嗎? – Ahmed 2016-06-06 09:53:54