我創建了nib文件,並且正確地完成了所有連接。當我運行應用程序並選擇一個單元格時,新的筆尖根本不打開。請幫忙!爲什麼選擇單元格後視圖筆尖無法打開?
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the selected country
NSString *selectedCountry = [[NSString alloc] initWithFormat:@"you pressed for this."];
//Initialize the detail view controller and display it.
DetailViewController *dvController = [[DetailViewController alloc]
initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
dvController.selectedCountry = selectedCountry;
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
}
發佈'selectedCountry'或者你泄漏。它在導航控制器上嗎?在'pushViewController:animated:'方法後立即嘗試'NSLog(@「%@%@」,self.navigationController,dvController);'讓我們知道結果。 –
你會得到哪個錯誤?也'dvController =零;'不需要,因爲你之前從內存中刪除dvController。 – sherilyn
@Deepak,我在DetailViewController.m中發佈了selectedCountry,並試着告訴我,但沒有運氣! – Jovany