So I have an iOS5 application (xcode 4.2) where I have a viewcontroller with a UIImageView set to a certain image. I would like to change this image to another image after 2 seconds. There is no user interaction, and the only thing that needs to happen is for the image to change after 2 seconds. I found information on dispatch_time, so I tried that.
If you type dispatch_time in main.m, it gives you a few lines of code and you need to insert what it should do after 2 seconds. My questions:
-
Is the dispatch_time code indeed meant to go in main.m ? Assume that this application does nothing else than change the UIImageView to display another image after 2 seconds.
-
How do I reference the UIImageView from main.m? The declaration in the view controller .h file is like this:
@property (weak, noatomic) IBOutlet UIImageView *Image;
Use the dispatch code in your view controller, probably in
viewDidLoad: