【发布时间】:2011-09-25 18:35:49
【问题描述】:
我对 Three20 很陌生。我关注了 ray wenderlich 的漂亮introduction to three20 和three20 框架中的示例。当我单击缩略图视图(TTThumbsViewController 的子类)中的缩略图以启动详细信息视图时,标准详细信息图像视图(由TTPhotoViewController 或其超类部署)。我想使用我自己的详细信息视图实现而不是默认值。我在启动TTThumbsViewController和TTThumbsViewControllerDelegate方法的子类时放了如下代码:
- (id)initWithDelegate:(id<TTThumbsViewControllerDelegate>)delegate {
[super initWithDelegate:delegate];
return self;
}
- (void)thumbsViewController: (TTThumbsViewController*)controller
didSelectPhoto: (id<TTPhoto>)photo {
[navigationController.pushViewController:photoDetailViewController
animated:Yes];
}
但默认的TTPhotoViewController 视图仍然占上风。当我在委托方法中放置一个 NSLog 时。我可以看到该方法被调用。我认为有人已经在TTThumViewController 中设置了另一个代表?有人可以推荐一种显示我的详细照片视图的方法吗?我可以使用另一个拇指视图控制器吗?任何建议将不胜感激。
【问题讨论】:
-
我可以通过以下方式作弊来加载我自己的详细图像视图:(1)在 TTThumbsViewController 子类中添加 self.delegate = self,然后(2)添加 thumbsViewController:didSelectPhoto: { / /do push a new navigation controller here }, (3) add - (TTPhotoViewController*)createPhotoViewController { return nil;} 现在它做了我想要的,但在调试器中它抱怨:应用程序试图在目标
。因为在第 (3) 步中,我强制它返回一个 nil 视图控制器。如果有人有更好的解决方案,请告诉我。谢谢!