Skip to main content

how to use an animated gif file in iphone application



i have an animated gif file and i want to use in my iphone application,but the animation doesnt work,anybody know how to fix it?





Source: Tips4all

Comments

  1. If you have a serie of images you want to animate you can easily do it with UIImageView:

    UIImage *blur5 = [UIImage imageNamed:@"blur5.png"];
    UIImage *blur6 = [UIImage imageNamed:@"blur6.png"];

    self.imageView.animationImages = [[NSArray alloc] initWithObjects:blur5, blur6, nil];
    self.imageView.animationRepeatCount = 5;
    [self.imageView startAnimating];


    I found this easier than trying to use UIWebView.

    ReplyDelete
  2. UIWebView does not properly display all GIF content. You need to use a UIImageView, but the iPhone OS does not support animated GIFS and only displays the first frame.

    So you need to extract all of the other frames first.

    Crude example code here:
    http://pliep.nl/blog/2009/04/iphone_developer_decoding_an_animated_gif_image_in_objc

    ReplyDelete
  3. You can use source at http://blog.stijnspijker.nl/2009/07/animated-and-transparent-gifs-for-iphone-made-easy/
    It has a GIF decoder that you can use directly to get solution.
    I successfully used it. But it have some problems with transparency.

    ReplyDelete
  4. Excellent article on 'Animating gif and animating images'

    http://iphonedevelopertips.com/graphics/animated-gif-animated-images-iphone-style.html

    ReplyDelete
  5. one other option is to decode the gif in your application and then "frame serve" it to a opengl object, this way is less likely to run out of memory for large gifs

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex