I have an image on WKInterfacecontroller. and i have 10 image frames (frame_0.png to frame_9.png)
in normal when we want to make that image animated we can simple do like this:
stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimating()
or we can make animate with Range:
stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimatingWithImagesInRange(NSMakeRange(0, 9) , duration: 10 , repeatCount: 0)
but now i want my Image start animated from the frame_3 and continue to make animate after the image run to frame_9
(my image will run from frame 3 -4 -5....to 9 and so on continue to 0 -1 - 2- 3..) How can i do that? I already tried :
stopWatchAnimateImage.startAnimatingWithImagesInRange(NSMakeRange(3, 9) , duration: 6 , repeatCount: 0)
but not work and this:
stopWatchAnimateImage.setImage(UIImage(named: "frame_3"))
stopWatchAnimateImage.startAnimating()
but my image become blank.
After check some solution, finally we can make this simple like this: make one animate with range and make delay time , after that we can continue make a continue animated like this:
stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimatingWithImagesInRange(NSMakeRange(3, 9) , duration: 7 , repeatCount: 1)
dispatch_after(dispatch_time(
DISPATCH_TIME_NOW,
Int64(7 * Double(NSEC_PER_SEC))
), dispatch_get_main_queue(), { () -> Void in
self.stopWatchAnimateImage.startAnimating()
})