i used the basic ui image code to load my animated gif... but when i clicked build and go and loaded the aplication it only showed the first frame of my gif and no animation??? help me???
Don't anim gifs have a flag (set at export from the creation application) to dictate playback parameters? Been a while since I created one, but this seems to ring a bell...
I dont know how SDK treats animated GIFs but you could easily set up a sequence of separate pictures into UIImageVIew and then run startAnimating to play the animation of that image sequence. Just export every frame of your gif to separate image and then use animationImages array property of UIImage view to add UIImages
A flag is a switch, i.e. an option you can set in the file dialog when you save your gif.
For example, "Looping? [Yes/No]"
If no options are present then the problem may lie elsewhere. Have you tried loading it into another animgif supporting application and re-saving?
The guy in this thread had problems with animgif (Safari, if that has any relevence) - he solved it simply by creating a fresh page, so the reason it wasn't working was never uncovered. Simply an iPhone idiosyncracity or bug, perhaps.
I fixed all this, and put it in a simple class. My class also support transparency . It's free to use commercially, as long as you leave an attribution in the code to me.
I tried your class and it is nicely done. I found that compressed GIF frames do not work because any compressed frame needs to be combined with the previous frame to get a full image.
Unfortunately I've not been able to figure out how to implement it.
Some frames of the image are fully stored (such as the first frame), but other frames are compressed and only contain changes that have to be applied to the frame before it.
For example, the second frame is compressed and needs to be masked upon the first frame to create a complete second frame image.
The first frame can be saved immediately, and consecutive frames can be applied by using - maskFrame: withFrame:
However.... animated GIF images may also contain several frames that are "stand-alone", and those do NOT have to be masked upon their predecessor.
I've not been able to find out how in de GIF specifications how to detect if a frame can be displayed "as is" or of it needs to be applied to the previous frame.
If you can be of any assistance, please build it into your class
I fixed all this, and put it in a simple class. My class also support transparency . It's free to use commercially, as long as you leave an attribution in the code to me.
Seems like it would be easier to manually split the gif into frames, using some 3rd party program. I'm sure you can find some free programs that do this, just google for it. Then take the resulting image frames, and use them in a UIImageView or what-have-you.
#1. If it's 3rd party and you dont have access, it's not a good idea anyways, because if that image ever gets removed, then your app is useless.
#2. If it's not 3rd party, then you would have access. So instead of using it as a gif, provide yourself with the still frames and then just animate it on the iPhone.
#3. it could be 3rd party by use of an API or other standards you are following without any risk of removal
#4, it could be 1st party (eg on your own website) like for instance a news site where content and images need to be downloaded regularly and the images can not be stored in the app bundle beforehand.
Seems like it would be easier to manually split the gif into frames, using some 3rd party program. I'm sure you can find some free programs that do this, just google for it. Then take the resulting image frames, and use them in a UIImageView or what-have-you.
Thanks for the suggetion I took it apart and put it back together works great now