我已經花了幾個小時,並嘗試了各種各樣的東西。我可以確認didSelectRowAtIndexPath確實正在運行,並且我正在查找的特定對象正在返回。新視圖沒有被加載 - 正在使用pushViewController
不做任何事的位是我試圖顯示SensDetailViewClass視圖的部分。它運行代碼,但SensDetailViewClass.m中的viewDidLoad方法不運行,視圖也不會改變。
我想顯示SensDetailViewClass。我可以確認.xib文件的所有者是SensDetailsViewClass。
請幫忙。這是代碼。
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// get the selected item
Sens *info = [_sensInfos objectAtIndex:indexPath.row];
// initialise the detail view controller and display it
SensDetailViewClass *details = [[SensDetailViewClass alloc] initWithNibName:@"MainWindow" bundle:nil];
// set the title of the page
[details setTitle:info.heading];
details.selectedSens = info;
[self.navigationController pushViewController:details animated:YES];
[details release];
}
更新:我得到了它通過使用這種機制的工作: [自我presentModalViewController:細節動畫:是];
感謝您的回答,但我不明白我必須做的。請解釋。 – 2011-04-09 08:10:41
告訴我SensDetailViewClass的nibname。 – 2011-04-09 08:11:44
SensDetailViewClass.xib – 2011-04-09 08:21:41