【问题标题】:My CustomViewController is not being called我的自定义 ViewController 没有被调用
【发布时间】:2012-09-06 20:52:52
【问题描述】:

这与Using a protocol and a delegate 有关,我已将问题范围缩小了一点

我有一个带有两个正确显示视图的 NavigationController。

“GraphView”是一个名为 GraphViewController 的 ViewController 中的视图。在对象检查器中 “GraphViewController”和“GraphView”分别正确显示在 ViewController 和 View 的自定义类框中。

但是,在 GraphViewController 中,我已将此代码(如下)放在 setGraphView 方法中,并且它从未被调用。好像 GraphViewController 没有被设置为 GraphView 的 GraphViewController。

我使用的代码是(我@synthesize GraphView 进一步向上)

- (void) setGraphView:(GraphView *)graphView {
    _graphView = graphView;
    self.graphView.dataSourceDelegate = self;
    [self.graphView setNeedsDisplay];
    NSLog(@"just set Graph View");
    }

我从来没有收到过 NSLog 消息,我在一个类似(但可以工作)的应用程序中这样做。

【问题讨论】:

  • 您是否在 Connection Inspector 中进行了实际连接?
  • 你能描述一下吗?究竟是那个过程?
  • 在我看到的图形视图控制器中,First Responder,图形视图控制器 - GraphViewController、View、GraphView、导航项 - 图形查看器以及导航控制器和我的根视图控制器的条目
  • 看我的回答,谢谢建议

标签: model-view-controller view xcode4 viewcontroller


【解决方案1】:

关于链接的评论是一个线索。我通过 ctrl 将链接从视图下方的栏中的圆形图标拖到 GraphView 视图组件中,即 View 组件位于 ViewController 中,从而重新制作了链接。

检查器的内容保持不变,但它起到了作用,随后代码正在运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多