I am a very beginner programmer and I am trying to find the easiest way to do this. Iβve never done anything with animation before. I want to try image animation in my application and I am having some problems. This is the code previously suggested to be used (on another issue):
imageView.image = yourLastImage; // Do this first so that after the animation is complete the image view till show your last image. NSArray * imageArray = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"image1.png"], [UIImage imageNamed:@"image2.png"], [UIImage imageNamed:@"image3.png"], [UIImage imageNamed:@"image4.png"], nil]; // Note: here you may instead want to use something like [UIImage imageWithContentsOfFile:[self localImagePath:NO]] instead depending upon your targeted iOS version. UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame: CGRectMake(100, 125, 150, 130)]; animatedImageView.animationImages = imageArray; animatedImageView.animationDuration = 1.1; myAnimation.animationRepeatCount = 1; animatedImageView.contentMode = UIViewContentModeBottomLeft; [self.view addSubview:animatedImageView]; [animatedImageView startAnimating];
Well, firstly, is it even practical? I want to animate something that goes from the middle of the screen to the bottom of the screen. Does this mean that I should have 500 images, each 1 pixel apart? What is the optimal pixel spacing so that it looks fluid and doesn't even require a ton of work? Is there a better way to animate than higher? Is there a program that helps you create animations that you can later add to Xcode?
Also, can someone explain the code above? I am new to animation, I donβt quite understand what all this means.
Sorry if this is a stupid question, I said at the opening that I am new. Thanks for any help you can provide!
arrays ios objective-c xcode animation
user1917407
source share