我是iOS开发的新手。我想使用UINavigationController从一个视图移动到另一个视图。请告诉我是否可能,如果可能的话,如何?
答案 0 :(得分:1)
请尝试以下代码:
SecondVC *detailView = [[SecondVC alloc] initWithNibName:@"SecondVC" bundle:nil];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
答案 1 :(得分: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];