【发布时间】:2011-06-17 13:30:43
【问题描述】:
我在自定义 QLPreviewController 的外观时遇到问题。
我们可以通过将 QLPreviewController 推入导航控制器或将其呈现在 ModalViewController 中来显示它。由于我的 navigationController 的栏被定制了一点(tintColor),我正在推动 QLPreviewController 以保留我的配色方案。但是当我推送它时,QLPreviewController 似乎出现了一些问题:我需要系统地调用 [qlpvc reloadData] 以便显示我的文件。
在 iOS [已编辑] 中,即使使用 reloadData,推送方式也不会显示任何内容(实际上它以随机方式显示)。所以我决定只使用可靠的 Modal 方式会很有趣。
我的意思是我想在 ModalViewController 中展示我的 QLPreviewController。这种方式效果很好,但我无法自定义 viewController 的外观。
例如在didSelectRowAtIndexPath 如果我这样做:
(我身边没有我的消息来源,如果我做错了,请见谅)
QLPreviewController *qlpvc = [[QLPreviewController alloc] init];
qlpvc.dataSource = self; // Data Source Protocol & methods implemented of course
No need for delegate in my case so //qlpvc.delegate = self;
qlpvc.currentPreviewItemIndex = [indexPath.row];
// The following doesn't work :
[qlpvc.navigationController.navigationBar setTintColor:[UIColor redColor]];
// The following doesn't work too :
[qlpvc.modalViewController.navigationController.navigationBar setTintColor:[UIColor redColor]];
[self presentModalViewController:qlpvc animated:YES];
[qlpvc release];
tl ;博士版: 如何管理自定义我的 modal QLPreviewController 的外观?尤其是navigationBar的tintColor?
非常感谢。
【问题讨论】:
标签: iphone objective-c ios xcode cocoa-touch