[英]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.