daspianist
daspianist

Reputation: 5495

Trouble using UIImageView to show animations

I am an iOS beginner working through the Pragmatic iOS book, and am having trouble with one of the chapter end "challenges" where I am to show slideshow of images in the UIImageView in my nib file.

I have a model class Recipe.h, as well as a ViewController and the standard AppDelegate.h files. Everything that is all wired up correctly, and if I were to show only one image in my UIImageView via self.imageView.image = self.recipe.image, everything works correctly. However, if I were to do the following and attempt to show using animnationImages, no images show up:

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //...some code here

    if(self.recipe.imageArray){
        self.imageView.animationDuration = 2;
        self.imageView.animationRepeatCount = 2;
        self.imageView.animationImages = self.recipe.imageArray;
        NSLog(@"%@", self.imageView.animationImages);
    }
}

My NSLog outputs the UIImage: 0x7520d60, UIImage: 0x7522390, which I take it that self.imageView.animationImages has the images located in memory. However, why are the pictures not showing up?

Thanks.

Upvotes: 0

Views: 76

Answers (1)

Francesco Puglisi
Francesco Puglisi

Reputation: 2177

Use

[self.view startAnimating];

Upvotes: 1

Related Questions