iOS 数据源委托
我一直在学习针对 iOS 5.0 开发的斯坦福 CS193p 课程(可在 iTunes U 上获取),并在尝试作业 3 时遇到问题 (pdf)。
我正在尝试在我之前开发的计算器模型之上实现一个图形计算器。在我的故事板中,我在计算器中添加了一个“图形”按钮,该按钮连接到一个新的视图控制器。其中有一个名为“GraphView”的视图。我需要委托此视图的数据源。我可以在我的 GraphViewController 中设置它,如下所示:
self.graphView.dataSource = self;
我也可以在 Interface Builder 中设置它。我想做的是将其设置为我的 CalculatorViewController,它首先发送 segue 消息,但在其代码中没有提及 GraphViewController 或 GraphView,所以我不确定如何完成此操作。 Interface Builder 也不会让我将数据源拖出它自己的视图框架。
简短版本:我想将我的数据源从我的图形视图委托给我的 CalculatorViewController。请参阅此处的故事板:故事板。
任何帮助将不胜感激。
I've been working through the Stanford CS193p course for iOS 5.0 development (available on iTunes U) and have run into a problem whilst attempting Assignment 3 (pdf).
I am trying to implement a graphing calculator on top of a previous calculator model I have developed. In my storyboard I have added a "graph" button to my calculator which segues to a new view controller. Inside this is a view called 'GraphView'. I need to delegate the data source for this view. I can set it inside my GraphViewController like so:
self.graphView.dataSource = self;
I can also set that in Interface Builder. What I would like to do is set it to my CalculatorViewController, which first sent the segue message, but there is no mention of GraphViewController or GraphView in it's code, so I'm not sure how to accomplish this. Interface Builder would not let me drag the data source out of it's own view's frame either.
Short version: I want to delegate my data source from my Graph View to my CalculatorViewController. See the storyboard here: Storyboard.
Any help would be very greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在prepareForSegue 函数中执行此操作。您可以在 PsychologyViewController.m 中找到与此操作类似的示例。
You can do this in the prepareForSegue function. You can find a similar example to how this is done in PsychologistViewController.m.