1 UINavigationController 方法进行跳转
[self.navigationController pushViewController:newUI animated:YES];
[self.navigationController popViewControllerAnimated:YES];
2 UIViewController 与 UIViewController之间的跳转
[self presentViewController:newUI animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];
3 storyboard的连线跳转
1 使用storyboard连线后,系统会自动回调prepareForSegue方法,要重写下边的方法
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{}
传值则用
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
id destController = segue.destinationViewController;
[destController setValue:self.desc forKey:@"context"];//第二页的定义的NSString *context;
}
注意:在使用storyboard开发时,用到了 presentViewController,这个新的界面不用在storyboard里面了,只能重新添加个.xib;
本文介绍了iOS开发中UINavigationController的push和pop方法、UIViewController间的present和dismiss方法及storyboard连线跳转技巧,包括prepareForSegue方法的重写与参数传递。

5267

被折叠的 条评论
为什么被折叠?



