我有一个带有 TableView 的 View ,触摸行我想导航到另一个 View 。 一切正常,但按钮、标签和其他内容未在 View 中呈现。
为了导航到其他 View ,我使用此代码:
GenderViewController *myController = [[GenderViewController alloc] initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:myController animated:YES];
[myController release];
请问哪里有问题?
谢谢!
最佳答案
您使用 Storyboard,因此请为您的 viewController 使用 segue 或标识符。
GenderViewController *myController = [[GenderViewController alloc] initWithNibName: nil bundle:nil];
不会有太大帮助,因为您没有提供 Nib 名称(我认为您不能将它与 Storyboard一起使用,因为您没有 Nib 名称,但我不是 100% 确定)。
在 Interface Builder 中设置您的 viewController 的标识符并像这样实例化它:
GenderViewController *myController = [self.storyboard instantiateViewControllerWithIdentifier: @"yourIdentifier"];
关于iOS 导航到 didSelectRowAtIndexPath 上的其他 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14851347/