我是 iOS 开发的新手。我想使用 UINavigationController 从一个视图移动到另一个视图。请告诉我是否可能,如果可能,比如何?
问问题
417 次
2 回答
1
试试下面的代码:
SecondVC *detailView = [[SecondVC alloc] initWithNibName:@"SecondVC" bundle:nil];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
于 2013-10-11T08:24:27.873 回答
0
使用以下方式:
.h 文件
#import "SecondViewController.h"
.m 文件
- (IBAction)gotoSecondView:(id) sender
{
NSLog(@"I am going to Second View");
SecondViewController *SecondView = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:SecondView animated:YES];
[SecondView release];
}
对于故事板:
SecondViewController* SecondView = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"];
[self presentModalViewController:SecondView animated:YES];
于 2013-10-11T08:24:54.650 回答