Wednesday, 15 January 2014

ios - Animate by alternating different UIImages -


I have two different images, which are essentially just the opposite of each other, I create a somewhat moving effect To do them want to animate them back and forth. I have FinishLaunching done in AppDelegate:

  myImageWalk = [[UIImageView alloc] initWithFrame: CGRectMake (0,0, 320, 568)]; [Self.meamwalk set image: [self loading image]]; [Add window subeview: myImageWalk]; [Window loujewivytroprint: my imager]; After that, in App Delegate, I also have:  
  - (UIImage *) loading image {NSARA * AnimationFrame = [NSARRArrayView Object: [ UIImage Image Named: @ "Original Page"], [UIImage imageNamed: @ "second.png"], [UIImage imageNamed: @ "original.png"], [UIImage imageNamed: @ "second.png"], [UIImage imageNamed : @ "Original page": [UIImage imageNamed: @ "second.png"], [UIImage imageNamed: @ "original.png"], [UIImage imageNamed: @ "second.png"], [UIImage imageNamed: @ "Original PGN "], [UIImage Image Named: @" Second Page "], [UIImage Image Named: @" Original Page "], [UIImage Image No Dated: @ "Second page"], [UIImage Image Named: @ "Original Page"], [UIImage imageNamed: @ "second.png"], [UIImage imageNamed: @ "original.png"], [UIImage imageNamed: @ "Second.png"], [UIImage imageNamed: @ "original.png"], [UIImage imageNamed: @ "second.png"], zero]; Return [UIImage Animated Image With Vision: Animation Frame Duration: 6.0f]; }   

But, nothing happens, no image is ever displayed. What am i doing wrong

Below are some code you can try to note that you need to repeat the series of images Not: Set the required duration for only one loop.

  myImageWalk = [[UIImageView alloc] initWithFrame: CGRectMake (0,0, 320, 568)]; MyImageWalk.image = [self loading image]; Self.myImageWalk.animationRepeatCount = 0; [Add window subeview: myImageWalk]; [Window loujewivytroprint: my imager]; // When you want to start animation [self-irregular images]; // Then at some reasonable time later: [self-stopping images]; - (UIImage *) Loading Image {NSArray * AnimationFrame = [NSARRAR with Objects: [UIImage imageNamed: @ "original.png"], [UIImage imageNamed: @ "second.png"], zero]; Return [UIImage Animated Image With Vision: Animation Frame Duration: 6.0f]; } - (zero) animated images (if (! [My] image walk is animating) {[self. Iijjok startAnnaming];}} - (zero) stop animation images {if ([self. Is my image walk animating]) { Selfmemiwok stop animation]; }}   

Note: Unless it is a test app or class assignment, you should move this argument from AppDelegate to ViewContoller, as it was done during DidFinishLaunching The best practice is to reduce.

No comments:

Post a Comment