Here is my doubt !!!
How to run the gif image directly from nsmutablearray which i stored images dynamically by assigning it to Wkinterfaceimage ???
Currently i'm working on the GIf Images assigning to the wkinterfaceimage. I stored set of images in a Mutablearray in run time by converting a gif image. How to assign that array to wkinterfaceimage to show run gif image. i found couple of tutorials in swift tried to implement in OBJ C, Plz let me know ur ideas and code in Objective C
Here is my code
[imageView setImage:[frames objectAtIndex:0]];
[imageView startAnimatingWithImagesInRange:NSMakeRange(0,frames.count) duration:1 repeatCount:0];
using above code showing blank screen on similator, if commented second line showing 0 index image.
Results of Frames rate
2015-04-08 10:21:53.206 WatchkitDemo WatchKit Extension[852:24553] {
DelayTime = "0.1";
UnclampedDelayTime = 0; }
Results of Frames array
2015-04-08 10:21:58.807 WatchkitDemo WatchKit Extension[852:24553] (
"<UIImage: 0x7fe358d2d320>",
"<UIImage: 0x7fe358f05d60>",
"<UIImage: 0x7fe358f08230>",
"<UIImage: 0x7fe358d2fd50>"
)
There is a way to convert gif image received from server into an array. I think Mayoff's UIImage Category can help you. I can give you an idea for what you can do:
1) Receive gif with either of the methods defined in category:
+[UIImage animatedImageWithAnimatedGIFData:(NSData *)data]
+[UIImage animatedImageWithAnimatedGIFURL:(NSURL *)url]
2) Go in the implementation file UIImage+animatedGIF.m. At line#89, method animatedImageWithAnimatedGIFImageSource
has been implemented. A method createImagesAndDelays
has been called there to create array of images. It is storing separated images in variable declared as CGImageRef images[count]
.
You can make this variable an instance variable, or make static method return an array of splitted gif images.
3) Convert those images in the format accepted by Wkinterfaceimage
.
Hope it helps :)