2013-06-03 32 views
0

我在我的xcode項目中使用了.gif文件。我已經用不同的幀間延時替換了我的gif。但它並不反映這些變化。幀之間的變化已經在gif中完成了。該.gif文件的預覽顯示了更改,但在模擬器上它不反映相同的延遲!請幫忙。.gif文件沒有反映xcode項目的延遲變化

回答

0

我可以爲你提供一個簡單的解決方案,你可以繼承this library,然後你只需要添加一個

NSURL *url = [[NSBundle mainBundle] URLForResource:@"JuU08" withExtension:@"gif"]; 
[SharedImageButton setImageWithURL:[ImageArray objectAtIndex:indexPath.row] placeholderImage:[UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]]]; 

JuU08就是你的gif圖片的名稱的單一方法添加到您的項目。在這裏,我已將該圖片添加到UIButtonUITableView中。

鏈接: - https://github.com/mayoff/uiimage-from-animated-gif

而不是添加多個幀與時間延遲它可以成爲累人的。希望這可以幫助....

+0

什麼是SharedImageButton和ImageArray? – Chiran

+0

對不起我的壞!我應該怎麼做才能在UIImageView中顯示gif圖像? – Chiran

+0

只需添加UIImage * image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];而不是第二行.... – IronManGill