0
我爲3.2編寫的代碼在OS4中表現不同。仍然沒有錯誤,只是新的錯誤。OS4是否改變了iPhone讀取代碼的方式?
所以我初始化了一個名爲「隨機化」的IBAction中的imageView,它產生了一個隨機數,並生成一個生成動畫和圖像的86個案例之一,0和86之間代碼的唯一區別就是最終圖像View .image(我只是不想過去86個相同代碼的副本,因爲你不得不通過)。無論如何,動畫imageView.animationImages都會運行。這個錯誤是我第一次運行動作時,imageView.animationImages運行顯示我的動畫,然後代替完成代碼並轉到imageView.image = [UIImage imageNamed:@「image36.png」],它現在只顯示無論我在Interface Builder中設置爲實際的imageView背景。有時它運行一個案例的動畫,另一個案例運行imageview.image。有任何想法嗎?
- (IBAction)randomize {
int Number = arc4random() % 86;
switch (Number) {
case 0:
imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
[UIImage imageNamed:@"image5.png"],
[UIImage imageNamed:@"image6.png"],
[UIImage imageNamed:@"image7.png"],
[UIImage imageNamed:@"image8.png"],
[UIImage imageNamed:@"image9.png"],
[UIImage imageNamed:@"image10.png"],
[UIImage imageNamed:@"image0.png"],nil];
imageView.animationDuration = 0.50;
[imageView setAnimationRepeatCount: 1];
[imageView startAnimating];
imageView.image = [UIImage imageNamed:@"image36.png"];
break;
case 1:
imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
[UIImage imageNamed:@"image5.png"],
[UIImage imageNamed:@"image6.png"],
[UIImage imageNamed:@"image7.png"],
[UIImage imageNamed:@"image8.png"],
[UIImage imageNamed:@"image9.png"],
[UIImage imageNamed:@"image10.png"],
[UIImage imageNamed:@"image0.png"],nil];
imageView.animationDuration = 0.50;
[imageView setAnimationRepeatCount: 1];
[imageView startAnimating];
imageView.image = [UIImage imageNamed:@"image37.png"];
break;
請詳細說明。 – kennytm 2010-07-27 18:29:41
對不起,忘記了包含片段 – Tru99 2010-07-27 18:41:41
哦......我的......親愛的......請不要告訴我你在這裏有86個案例陳述。 – 2010-07-28 04:36:46