Ok So In My Xcode project I Have A button That I need to do the same method twice but with A Different Image Plz Help
Code:
UIImage * toImage = [UIImage
This is what methods are for. Create a method that takes an image name:
- (void)transitionToImage:(NSString *)imageName {
UIImage * toImage = [UIImage imageNamed:@"CharacterBackwards.png"];
[UIView transitionWithView:self.view
duration:0.01f
options:UIViewAnimationOptionTransitionNone
animations:^{
self->Guy.image = toImage;
} completion:NULL];
}
Now have your button handler call this twice:
- (IBAction)buttonHandler {
[self transitionToImage:@"CharacterBackwards.png"];
[self performSelector:@selector(transitionToImage:) withObject:@"CharacterForwards.png" afterDelay:0.4];
}