ios导航实现页面切换
来源:互联网 发布:截图软件下载 编辑:程序博客网 时间:2024/04/29 08:13
1.在AppDelegate.m实现的事件代码,用UINavigationController来进行页面之间的切换
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window =[[UIWindowalloc] initWithFrame:[[UIScreenmainScreen]bounds]];
self.window.backgroundColor=[UIColorwhiteColor];
rootView * r=[[rootViewalloc]init];
UINavigationController * nav=[[UINavigationControlleralloc]initWithRootViewController:r];
self.window.rootViewController=nav;
[self.windowmakeKeyAndVisible];
returnYES;
}
2.用tab bar 来切换view
对应的按钮事件
-(IBAction)btnTab
{
UITabBarController* tabBarController = [[UITabBarControlleralloc]init];
first *firstViewController = [[firstalloc] initWithNibName:nilbundle:nil];
UINavigationController *firstNavigationController = [[UINavigationControlleralloc] initWithRootViewController:firstViewController];
[firstNavigationController setNavigationBarHidden:YESanimated:YES];
[firstNavigationController setTitle:@"第一视图"];
second *secondViewController = [[secondalloc] initWithNibName:nilbundle:nil];
UINavigationController *secondNavigationController = [[UINavigationControlleralloc] initWithRootViewController:secondViewController];
[secondNavigationController setNavigationBarHidden:YESanimated:YES];
[secondNavigationController setTitle:@"第二视图"];
third *thirdViewController = [[thirdalloc] initWithNibName:nilbundle:nil];
UINavigationController *thirdNavigationController = [[UINavigationControlleralloc] initWithRootViewController:thirdViewController];
[thirdNavigationController setNavigationBarHidden:YESanimated:YES];
[thirdNavigationController setTitle:@"第三视图"];
forth *forthViewController = [[forthalloc] initWithNibName:nilbundle:nil];
UINavigationController *forthNavigationController = [[UINavigationControlleralloc] initWithRootViewController:forthViewController];
[forthNavigationController setNavigationBarHidden:YESanimated:YES];
[forthNavigationController setTitle:@"第四视图"];
tabBarController.viewControllers = [NSArrayarrayWithObjects:firstNavigationController,secondNavigationController,thirdNavigationController,forthNavigationController,nil];
tabBarController.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
[selfpresentModalViewController:tabBarControlleranimated:YES];
}
- ios导航实现页面切换
- iOS-UINavigationController导航 页面切换效果
- Android:Fragment实现带导航条的页面左右切换
- 基于Agile Lite开发框架实现底部导航切换页面
- jquery实现html页面的导航的标签内容切换
- ios基于UITabBarController实现tab页面切换
- iOS开发使用Tab Bar Controller实现页面导航功能
- iOS 完美解决导航栏在页面切换时隐藏与显示的动画
- iOS页面之间切换
- IOS页面切换
- iOS 页面切换控制
- js实现简单导航切换
- jquery实现导航栏切换
- v-if实现导航切换
- iOS: SegmentControl 实现页面切换的四种方法
- iOS: SegmentControl 实现页面切换的四种方法
- iOS: SegmentControl 实现页面切换的四种方法
- iOS实现超酷页面切换动画特效
- ZOJ-1888 Trie模板题..但要注意审题..
- Android上dip、dp、px、sp等单位说明
- 黑马自学_HTML基本知识
- 黑马程序员-.Net基础1
- 如何在VC下将mak文件导入 .
- ios导航实现页面切换
- failed to load the jni shared library
- 设计模式---通知
- oracle中exp,imp的使用详解
- Android平台Qt开发入门教程
- 报这样的错误 error: #35: #error directive: "Please select first th 解决方法
- 1
- HTML5 Cheatsheat
- Android的自带主题