{"id":1520,"date":"2012-12-25T08:06:56","date_gmt":"2012-12-25T16:06:56","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=1520"},"modified":"2012-12-25T09:31:05","modified_gmt":"2012-12-25T17:31:05","slug":"using-an-animated-gif-in-ios","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=1520","title":{"rendered":"Using an animated gif in iOS"},"content":{"rendered":"<p><img decoding=\"async\" class=\"centered\" src=\"images\/Kite.gif\" alt=\"Kite gif\" \/><\/p>\n<p>You can\u2019t use gif&#8217;s in iOS but you can do the same thing with a series of png&#8217;s. Here&#8217;s the code that I use to put a kite on the screen and then animate the tail. <\/p>\n<p><pre><code class=\"\u201dsmaller\u201d preserve-code-formatting\">- (void)animatedReward {\n&nbsp;&nbsp;&nbsp;&nbsp;UIImageView *staticView = [[UIImageView alloc] initWithFrame:self.view.frame];\n&nbsp;&nbsp;&nbsp;&nbsp;staticView.image = [UIImage imageNamed:@&quot;kite.png&quot;];\n&nbsp;&nbsp;&nbsp;&nbsp;[self.view addSubview:staticView];\n&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;NSArray *imagesArray = [NSArray arrayWithObjects:[UIImage imageNamed:@&quot;kite-tail1.png&quot;], [UIImage imageNamed:@&quot;kite-tail2.png&quot;], [UIImage imageNamed:@&quot;kite-tail3.png&quot;], [UIImage imageNamed:@&quot;kite-tail2.png&quot;], [UIImage imageNamed:@&quot;kite-tail1.png&quot;], nil];\n&nbsp;&nbsp; \n&nbsp;&nbsp;&nbsp;&nbsp;UIImageView *animatedView = [[UIImageView alloc] initWithFrame:staticView.frame];\n&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;animatedView.animationImages = imagesArray;\n&nbsp;&nbsp;&nbsp;&nbsp;animatedView.animationDuration = 1;\n&nbsp;&nbsp;&nbsp;&nbsp;[animatedView startAnimating];\n&nbsp;&nbsp;&nbsp;&nbsp;[self.view addSubview:animatedView];\n}<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can\u2019t use gif&#8217;s in iOS but you can do the same thing with a series of png&#8217;s. Here&#8217;s the code that I use to put a kite on the screen and then animate the tail. &#8211; (void)animatedReward { &nbsp;&nbsp;&nbsp;&nbsp;UIImageView *staticView = [[UIImageView alloc] initWithFrame:self.view.frame]; &nbsp;&nbsp;&nbsp;&nbsp;staticView.image = [UIImage imageNamed:@&quot;kite.png&quot;]; &nbsp;&nbsp;&nbsp;&nbsp;[self.view addSubview:staticView]; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;NSArray *imagesArray = &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=1520\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Using an animated gif in iOS<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-1520","post","type-post","status-publish","format-standard","hentry","category-ios"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1520"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1520\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}