I am new to iOS development and this is my first question about SO.
I want to create an "animation".
When I press UIButton, I want to slowly (about 0.5 seconds) move it by 10 pixels, and when I raise my finger, I want to open a new viewController.
I did something, but I donโt know how to make an โanimationโ.
UIImage *normalImage = [UIImage imageNamed:@"FirstImage"]; UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; firstButton.frame = CGRectMake(31, 194, normalImage.size.width, normalImage.size.height); [firstButton setImage:normalImage forState:UIControlStateNormal]; [firstButton addTarget:self action:@selector(showSecondViewController) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:firstButton]; - (void)showSecondViewController; { SecondViewController *secondViewController = [[SecondViewController alloc] init]; secondViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:secondViewController animated:YES]; [progressViewController release]; }
source share