【问题标题】:TTViewController and popupViewController methodTTViewController 和 popupViewController 方法
【发布时间】:2010-01-26 13:15:07
【问题描述】:

我正在使用 TTLauncherView,为此我将视图控制器声明为 TTViewController,就像在 TTCatalog 教程应用程序中一样。在该视图中声明一个 TTLauncherView 变量,添加项目,等等。

在我的应用程序的主视图中有一个按钮,它使用以下代码调用上一个视图:

-(void) switchToButtonOrderingView
{
    ButtonOrderingViewController *ButtonOrderingView=
    [[ButtonOrderingViewController alloc] initWithNibName:@"ButtonOrderingViewController" bundle:nil]; 
    self.ButtonOrderingViewController = ButtonOrderingView; 
    [self.view insertSubview:ButtonOrderingView.view atIndex:10];
}

当我按下按钮时,应用程序会在属于 TTViewController.m 的这个方法处停止:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  UIViewController* popup = [self popupViewController]; //brakes up here
  if (popup) {
    return [popup shouldAutorotateToInterfaceOrientation:interfaceOrientation];
  } else {
    return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
  }
}

错误是这样的:

[ButtonOrderingViewController popupViewController]:无法识别的选择器发送到实例

查看 Three20 Class Hierarchy 和 TTViewController 是 UIViewController 子类。

popupViewController 是一个 TTPopViewController(及其子类)方法!我没有使用,TTCatalog 教程应用程序也没有使用。我迷路了。任何帮助将不胜感激。

谢谢。

【问题讨论】:

  • 希望得到对此的回应。我面临同样的问题。

标签: iphone uiviewcontroller three20


【解决方案1】:

遇到同样的问题,发现错误!

当您忘记根据 Three20 设置说明将 -ObjC 和/或 -all_load 添加到其他链接器标志时会发生这种情况。可能是您将它们添加到项目级别,并在较低级别进行了覆盖设置 - 对我来说就是这种情况。

【讨论】:

  • 请注意,当您使用用 Objective-C 编写的第三方静态库时,这是一个很常见的问题。您可以通过访问developer.apple.com/mac/library/qa/qa2006/qa1490.html 获得有关这些标志的更多信息。引用:“-ObjC 标志使链接器加载定义了 Objective-C 类或类别的库中的每个目标文件。[...] -all_load 标志强制链接器从它的每个存档中加载所有目标文件看到了,即使是那些没有 Objective-C 代码的人。”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-04-03
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多