animationRepeatCount Problem

Discussion in 'iOS Programming' started by endroits1, Nov 11, 2010.

  1. endroits1 macrumors newbie

    Joined:
    Nov 11, 2010
    #1
    Hi, first post here. I have wanted to try coding an app for awhile so I've read through a great cocoalabs code tutorial and have started Programming in Object-C 2.0. While reading those I have been doing some tutorials online to try out some ideas.

    So I've been trying to make an app where when you click a button it starts up a new view inside the same xib file that is playing a sprite animation. I wanted the animation to start right away when I got to the new view so I put it in the viewdidload section.

    My problem is that the code just continues to play on an endless loop. I have put in the animationRepeatCount to specify that I only want to it to play once but when I do that it makes nothing appear when I click for my animation.
    I've tried to google but can't find anything. I've put my code down below I hope that this is enough information.

    Thanks you

    Code:
    #import "SecondView.h"
    
    @implementation SecondView
    @synthesize dragon;
    
    - (void)viewDidLoad {
    	[super viewDidLoad];
    	
    	NSArray * anim1 = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"img2.jpg"],
    					   [UIImage imageNamed:@"img3.jpg"],
    					   [UIImage imageNamed:@"img1.jpg"],
    					   nil];
    	
    	dragon.animationImages = anim1;
    	dragon.animationDuration = 2.0;
    	dragon.animationRepeatCount=1.0;
    	[dragon startAnimating];
    	}
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    This is completely unrelated but you are leaking that array.
     
  3. endroits1 thread starter macrumors newbie

    Joined:
    Nov 11, 2010

Share This Page