IOS页面跳转的三种方式
第一第二种在AppDelegate.m文件里写
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor redColor];
hhuyViewController *hhuyView = [[hhuyViewController alloc] initWithNibName:@"hhuyViewController" bundle:nil];
self.window.rootViewController = hhuyView;
[self.window makeKeyAndVisible];
第三种同样但增加了下面的语句:
UINavigationController *nav = [[UINavigationControlleralloc] initWithRootViewController:hhuyView];
self.window.rootViewController = nav;
下面内容写在原来页面m文件里面
//按钮关联的方法
- (IBAction)buttonPressed{
//将第二个页面给他赋值,用对象来代替它
ViewController *viewControll = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nile]
}
1.最简单的:
[self.view addSubview:viewControll.view];
意思就是将其增加到手机图层上面。
2.有动画效果的:
[self presentViewController:viewControll animated:YES completion:^{
}];
意思一样但是好看
3.就是IOS7.0才有的:
[self.navigationController pushViewController:viewControll animated:YES];
顿时高大上
本文来自博客园,作者:赫凯,转载请注明原文链接:https://www.cnblogs.com/heKaiii/p/15491366.html

浙公网安备 33010602011771号