接觸到了兩個頁面之間的跳轉帶動畫的。效果還不錯。
一,先上項目總體圖。
二,上代碼。
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]; }