我有一個主 - 細節應用程序。我列出了MasterViewController tableview中應用程序文檔文件夾中的所有圖像。在單擊每個tableview項目時,我在DetailViewController中加載圖像,該圖像具有UIImageView。我面臨的問題是,當我點擊一個tableview項目時,圖像不會在第一個實例中加載。我只是在DetailViewController中看到消息「Detail view content goes here」。如果我回去再試一次,它會工作得很好。它只是圖像不會加載的第一次。在DetailViewController的第一個實例中不加載UIImage
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (!self.detailViewController) {
self.detailViewController = [[PtmDetailViewController alloc] initWithNibName:@"PtmDetailViewController" bundle:nil];
}
//NSDate *object = _objects[indexPath.row];
NSData *imgData = [NSData dataWithContentsOfFile:self.fPath];
UIImage *thumbNail = [[UIImage alloc] initWithData:imgData];
self.detailViewController.imgViewer.image = thumbNail;
[self.navigationController pushViewController:self.detailViewController animated:YES];
}
我在做什麼錯?任何幫助,將不勝感激。