我有一個應用程序,使用相機,槍圖像覆蓋以及火和重新加載按鈕。在視網膜iPad和iPhone上,它會在約1秒鐘內循環播放30幀圖像,並在2秒鐘內重播動畫。所有的圖像都是1920 x 1080,在iPhone上它們是1000 x 533。例如,當點擊觸發按鈕時,要循環瀏覽.png,我在PlayViewController.m文件中使用了這個:播放png動畫時的延遲
- (IBAction)fire:(id)sender {
// Play the firing animation for the rifle, enable reload button
fireButton.enabled = NO;
type.animationImages = gunanimload;
type.animationDuration = 1.0;
type.animationRepeatCount = 1;
reloadButton.enabled = YES;
[type startAnimating];
在viewDidLoad方法創建數組,並用圖像加載:
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage* img1 = [UIImage imageNamed:@"rev0001.png"];
... x30
gunanimload = [NSArray arrayWithObjects:img1, ... x30, nil];
}
即使它應該被加載陣列當視圖加載時,它仍然似乎是在做它時,消防按鈕被竊聽。我將如何消除這種延遲?還是有一個(相對簡單的)替代玩火和重新加載動畫?
無法理解你的問題 –