2011-07-25 30 views
1

控制動畫我有一些圖片,當我的手指移動到ipad的屏幕上時,它們會一個接一個地顯示,如果我的手指停住,立刻停下來,我在touchesMoved中使用下面的代碼功能如何用touchesMoved或其他

if (j>1199) { 
     j=1000; 
    } 
    else { 
     NSString *imgPath=[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%d",j] ofType:@"png"]; 
     show360img.image=[UIImage imageWithContentsOfFile:imgPath]; 
     j; 
    } 

,但它不能很好地工作,所以我如何控制這個動畫?非常感謝

+0

爲什麼它不能正常工作? – sergio

+0

@sergio它運行不順利 – matt

回答

0

j不被遞增。 增量j並嘗試編碼

if (j>1199) { 
    j=1000; 
} 
else { 
    NSString *imgPath=[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%d",j] ofType:@"png"]; 
    show360img.image=[UIImage imageWithContentsOfFile:imgPath]; 
    j++; 
}