接触到了两个页面之间的跳转带动画的。效果还不错。
一,先上项目总体图。
二,上代码。
AppDelegate.m文件
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. FirstViewController *firstView=[[FirstViewController alloc]init]; UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:firstView]; self.window.rootViewController=nav; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
FirstViewController.m文件
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"FirstVC"; self.view.backgroundColor=[UIColor redColor]; } //点击页面任何处跳转到页面二 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { SecondViewController *secondVC=[[SecondViewController alloc]init]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.9]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES]; [self.navigationController pushViewController:secondVC animated:NO]; [UIView commitAnimations]; }
SecondViewController.m文件
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"SecondVC"; self.view.backgroundColor=[UIColor blueColor]; }
时间: 2024-11-04 03:27:42