小编tom*_*nal的帖子

xcode 5中的instantiateViewControllerWithIdentifier

我正在使用xcode 5中的故事板.我有一个导航控制器,我正在尝试建立故事板中其他场景的过渡.我第一次尝试使用:

- (IBAction)handleTap:(UITapGestureRecognizer *)sender {
NSLog(@"Image clicked");

_detailPage = [[MPDetailPageViewController alloc] initWithNibName:@"MPDetailPageViewController" bundle:nil];
_detailPage.product = _curProduct;

//Bring to detail page
[self.navigationController pushViewController:self.detailPage animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

这会让我陷入黑屏.在stackoverflow上搜索我发现2013年2月的这篇帖子建议使用instantiateViewControllerWithIdentifier

所以我尝试过:

- (IBAction)handleTap:(UITapGestureRecognizer *)sender {
NSLog(@"Image clicked");

_detailPage = [self.storyboard instantiateViewControllerWithIdentifier:@"MPDetailPageViewController"];
_detailPage.product = _curProduct;

//Bring to detail page
[self.navigationController pushViewController:self.detailPage animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

但是,这给了我一个错误

Storyboard()不包含标识符为"MPDetailPageViewController"的视图控制器

我试图弄清楚如何查找/设置标识符并看到帖子引用Storyboard ID,但当我在屏幕上看时我只看到Restoration ID,我只能看到当我点击View而不是它ViewController自己.当我点击它时ViewController,我看不到Restoration ID也没有Storyboard ID

任何帮助将不胜感激!

iphone xcode objective-c ios xcode5

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

xcode ×1

xcode5 ×1