[英]XIB loads with black Screen from pushViewController
我有一个情节提要,里面加载了带有TableView的XIB。
当用户从TableView中选择一行时,应使用以下方法pushViewController加载新的XIB:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
[tableView deselectRowAtIndexPath:indexPath animated:YES];
RecipeDetailViewController *recipeDetailViewController = [[RecipeDetailViewController alloc] init];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *str = cell.textLabel.text;
recipeDetailViewController.navTitle = str;
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:recipeDetailViewController animated:YES];
}
加载的新XIB应该显示以下视图(内部带有按钮):
相反,它加载如下所示的黑色视图:
我检查了视图是否已连接到ViewController。 从我的角度来看,一切都很好。 在IB中,视图连接到文件的所有者:
我解决了 我要做的就是关闭XCode并重新打开该项目。 之后,一切都很好!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.