我有一个tableView,它列出了一个目录的内容,其中包括jpg,pdf,zip,mp3,mp4,sql,..文件甚至文件夹。对于下一步,我有一个detailView,它显示所选文件的一些属性,如fileName,fileSize,filePath,fileType。一切都很完美。
但实际上我的计划是在detailView中包含一个额外的选项。
即,
希望我的概念被叙述。请帮我继续处理一些示例代码。提前谢谢..
答案 0 :(得分:0)
根据文件类型创建动态detailView,处理图像的控制器,处理视频的控制器等。
例如(请参阅Apple提供的Sample SplitViewController):
UIViewController <SubstitutableDetailViewController> *detailViewController = nil;
if("movie cell tapped"){
MovieViewController *newDetailViewController = [[MovieViewController alloc] init];
detailViewController = newDetailViewController;
}
if("image cell tapped"){
ImageViewController *newDetailViewController = [[ImageViewController alloc] init];
detailViewController = newDetailViewController;
}
/* and so on */
// Update the split view controller's view controllers array.
NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];
splitViewController.viewControllers = viewControllers;
[viewControllers release];
// Dismiss the popover if it's present.
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:NO];
}
// Configure the new view controller's popover button (after the view has been displayed and its toolbar/navigation bar has been created).
if (rootPopoverButtonItem != nil) {
[detailViewController showRootPopoverButtonItem:self.rootPopoverButtonItem];
}
[detailViewController release];