常见的页面跳转的方法
来源:互联网 发布:php 页面重定向方法 编辑:程序博客网 时间:2024/05/19 14:51
1.//方法一presentViewController;用这种方法来推到下一个页面,有时候还需要返回到上一个页面的时候,就需要额外实现一个方法 ,与 presentViewController: 对应的返回方法为dismissViewControllerAnimated: 在第二个页面添加一个button 对其添加一个方法,方法的实现里面加上这一行代码就可以了
例如 [self presentViewController:detail animated:YES completion:nil];
//self.window.rootViewController=[[ViewController alloc]init];
2.//方法二UINavigation要求使用导航框架;UINavigationController相当于是一个容器,然后将所有的view都放到这个容器里面去
例如:[self.navigationController pushViewController:detail animated:YES];//返回代码popViewControllerAnimated
//在appdelegate中代码如下
//ViewController *view=[[ViewController alloc]init];
//UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:view];
//self.window.rootViewController=nav;
3.//方法三UITabBarController
UITabBarController *tab=[[UITabBarController alloc]init];//a.初始化一个tabBar控制器
self.window.rootViewController=tab;
UIViewController *c1=[[UIViewController alloc]init];
//c1.view.backgroundColor=[UIColor grayColor];
c1.tabBarItem.title=@”123”;
UIViewController *c2=[[UIViewController alloc]init];
//c2.view.backgroundColor=[UIColor brownColor];
c2.tabBarItem.title=@”456”;
//c.添加子控制器到ITabBarController中
//c.1第一种方式
// [tab addChildViewController:c1];
// [tab addChildViewController:c2];
//c.2第二种方式
tab.viewControllers=@[c1,c2];
4.将其他页面直接加到当前页面
[html] view plain copy
在CODE上查看代码片派生到我的代码片
view1=[[view21 alloc]initWithNibName:@"view21" bundle:nil]; [mainScr addSubview:view1.view]; view1.view.frame=CGRectMake(0, 0, 1024, 768);
其对应的返回到前一个页面的方法可以使用
[view1 removeFromSuper];
第四种:
introView = [[CompanyIntroViewController alloc]init];
[self.view insertSubview:introView.view aboveSubview:backImageView];
- 常见的页面跳转的方法
- 总结一些页面常见的跳转方法
- 页面跳转的方法
- 页面跳转的方法
- 页面跳转的方法
- JSP页面跳转的常见方式
- PHP开发常见的页面跳转技术
- iOS 常见的两种页面跳转
- Javascript跳转页面的方法
- 页面跳转的各种方法
- php页面跳转的方法
- flex 页面跳转的方法
- 页面跳转的方法收集
- servlet跳转页面的方法
- ExtAspNet页面跳转的方法
- 页面跳转的集中方法
- Android页面跳转的方法
- javaweb页面跳转的方法
- Android 内存泄漏总结
- 重建二叉树
- c++ 栈区 堆区 常量区
- startActivity流程
- Android的文件系统结构
- 常见的页面跳转的方法
- OC相关资料
- JVM虚拟机-GC(对象)
- 最近遇到window的坑
- SDWebImage详解
- URL URI File Path 转换(原创)
- Trustzone OP-TEE 在QEMU平台上的编译、运行与测试
- linu 查看某进程打开的文件数
- freemarker遍历集合