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];

顿时高大上

posted @ 2014-10-13 16:34  赫凯  阅读(43)  评论(0)    收藏  举报