0
當試圖使用storyboard tableviewcontroller實現動態表(使用代碼)時,執行下列代碼時無法推送詳細視圖。pushViewController似乎無法與故事板和QLPreviewController一起使用
[[self navigationController] pushViewController:previewController animated:YES];
沒有錯誤發生。除了所選表格單元格被突出顯示爲藍色並保持這種狀態之外,沒有提供任何線索。這個問題在使用故事板時非常普遍,但在使用xib時不是。
這裏是didSelectRowAtIndexPath
方法:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
previewController.delegate = self;
// start previewing the document at the current section index
previewController.currentPreviewItemIndex = indexPath.row;
[[self navigationController] pushViewController:previewController animated:YES];
[previewController release];
}
下面是一個樣品project with the issue的鏈接。
這工作。謝謝。這似乎不直觀,你必須添加兩個視圖來獲得一個,但它現在是有道理的。 – 2012-07-30 14:47:09