如何在委托方法之外访问委托返回的参数?
我有一个带有 UIPicker 的 UIViewController
,并且有 - (void)sourcePickerViewController:(SourcePickerViewController *)controller 等...
它返回几个位数据(等等...)给它的委托。在委托方法中,我看到了我想要的值,并且可以通过 NSLog 输出它们,但我不知道如何在代码中的其他地方使用它们。在具有该委托方法的同一个 UIViewController
中,我有另一个方法应该根据返回的数据更新一些 UITextFields
,但我收到诸如 dataVariableName 之类的错误未声明
。
有什么建议吗?
I've got a UIViewController
with a UIPicker on it and I've got the - (void)sourcePickerViewController:(SourcePickerViewController *)controller etc...
which returns several bits of data (the etc...) to it's delegate. Inside the delegate method, I see the values I want and can output them via NSLog
but I can't figure out how to use them elsewhere in the code. In the same UIViewController
that has that delegate method in it, I have another method that should update some UITextFields
based on the data returned, but I get errors like dataVariableName undeclared
.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当调用委托方法时,存储对委托类中变量的引用,然后您将能够在其他方法中使用它们。
When the delegate method is called store references to the variables in your delegate class, then you will be able to use them in other methods.