首页 > 移动平台 > 详细

iOS 页面跳转

时间:2014-04-16 18:56:30      阅读:702      评论:0      收藏:0      [点我收藏+]

【iOS开发】UIView之间常用视图之间切换方式

从一个Controller跳转到另一个Controller时,一般有以下几种: 
1、利用UINavigationController,调用pushViewController,进行跳转;这种采用压栈和出栈的方式,进行Controller的管理。调用popViewControllerAnimated方法可以返回。

1     PickImageViewController  *ickImageViewController = [[PickImageViewController  alloc] init]; 
2     [self.navigationController  pushViewController: ickImageViewController animated:true]; 
3     [ickImageViewController  release];
[self.navigationController pushViewController:subTableViewController  animated:YES];
//通过 NSNavigationBar 进行跳转

[self.navigationController popViewControllerAnimated:YES];
//在子视图返回到上级视图

 

2、利用UIViewController自身的presentModalViewController,进行跳转;调用dismissModalViewControllerAnimated方法可以返回。 

1 PickImageViewController *ickImageViewController = [[PickImageViewController alloc] init]; 
2     [self presentModalViewController:ickImageViewController animated:YES]; 
3 //返回 
4 [self dismissModalViewControllerAnimated:YES];
 AddInfo *control = [[AddInfo alloc] init];
[self presentModalViewController:control animated:YES];
[control release];
//通过事件进行跳转
[self dismissModalViewControllerAnimated:YES]; //描述:通过事件进行返回。
-(void)change:(id)sender{  
    second *secondview = [[second alloc] initWithNibName:@"second" bundle:nil];  
    [self presentViewController:secondview animated:YES completion:^{}];  
} 

 

 -(IBAction)NextPage:(id)sender
{
    Page_Second *control = [[[Page_Second alloc] initWithNibName:@"Page_Second" bundle:nil] autorelease];  //定义要跳转到页面
     [self.view.window setRootViewController:control];
 }

View跳转到UITabBarViewController

 

iOS 页面跳转,布布扣,bubuko.com

iOS 页面跳转

原文:http://www.cnblogs.com/hl666/p/3668917.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!