ios的兩種界面跳轉方式


1、在界面的跳轉有兩種方法,一種方法是先刪除原來的界面,然后在插入新的界面,使用這種方式無法實現界面跳轉時的動畫效果。

if(self.rootViewController.view.superview == nil){
       [singleDollController.view removeFromSuperview];
       [self.view insertSubview:rootViewController.view atIndex:0];
}
else{
       [singleDollController.view removeFromSuperView];
       [self.view insertSubview:singleDollController.view atIndex:0];
}

2、將跳轉的界面的Controller放入到UINavigationController中,使用push或pop實現跳轉,使用這種方式可用實現動畫效果。

navController= [[UINavigationControlleralloc]init];
[navController setNavigationBarHidden:YES];
[window addSubview:navController.view];
rootView= [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
[navController pushViewController:rootView animated:NO];
 
self.singleDollView= view;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeftforView:self.navController.view cache:NO];
[self.navController pushViewController:self.singleDollView animated:NO];
[UIView commitAnimations];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM