如何在委托方法之外访问委托返回的参数?

发布于 2024-09-11 17:00:39 字数 386 浏览 2 评论 0原文

我有一个带有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长亭外,古道边 2024-09-18 17:00:39

当调用委托方法时,存储对委托类中变量的引用,然后您将能够在其他方法中使用它们。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文