我有以下代码的有线问题。在iphone上幻灯片和转换?
如果我使用这些代码,并在模拟器上运行它,他只会向我显示阵列中的前两张图片。如果我在Iphone上运行它,他会向我显示第一张照片。 也他不重复的图片.-
什么iam做错了?
- (void)viewDidLoad{
[super viewDidLoad];
welcomePhoto = [NSArray arrayWithObjects:@"Bild.jpeg",@"Bild1.jpeg", @"Bild2.png", nil];
imageView.image = [UIImage imageNamed:[welcomePhoto objectAtIndex:0]];
[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(transitionPhotos) userInfo:nil repeats:YES];
}
-(void)transitionPhotos{
int photoCount;
if (photoCount < [welcomePhoto count] - 1){
photoCount ++;
}else{
photoCount = 0;
}
[UIView transitionWithView:self.imageView
duration:2.0
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{ imageView.image = [UIImage imageNamed:[welcomePhoto objectAtIndex:photoCount]]; }
completion:NULL];
}
您是否尝试过使用调试器来逐步通过您的代码? – Stefan 2012-04-24 14:00:09