我有一個16個按鈕的ViewController。每個按鈕加載顯示移動中的50幀的彈出窗口。框架與iPhone中的50 png
這樣做的最佳形式是什麼?
我知道imageWithName
是不好的,因爲它加載在高速緩存中的所有圖像,基於這個原因,IM與做:
myAnimatedView.animationImages=[NSArray arrayWithObjects:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0000",nombrePieza]ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0001",nombrePieza]ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0002",nombrePieza]ofType:@"png"]],
...
...
... [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0050",nombrePieza]ofType:@"png"]],nil];
但是當我加載酥料餅的約10倍型動物框架,我有一個內存泄漏只在我的設備上,但不在模擬器中。
因此,我想知道哪個是最好的形式來做到這一點?
帶視頻?或與CAAnimation
?
感謝您的幫助。
感謝您的回覆朋友。我不加載相同的50個圖像...每個按鈕都有50個不同的圖像,當我使用不同的圖像加載10次時,我的泄漏正在進行...有些解決方案? – 2012-04-09 15:26:23