iOS5 中的 UIPickerView Outlet 出现问题?
我不明白应该连接哪些插座! 在商店我有:
dataSource
delegate
但是我应该在哪里连接它们呢? 然后我该如何使用它们?
???
I don't understand which outlets should be connected!
In outlets i have:
dataSource
delegate
But where should i connect them?
And how can i then use them?
???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Xcode 中,连接数据源和将插座委托给包含 UIPickerView 的 UIViewController。 数据源方法在 UIViewController 实现中声明。假设您的选择器将显示:“英语”和“法语”:
委托方法也在 UIViewController 实现中声明:
如何使用
userSelectionFromPicker
执行的一些示例应用程序中的操作:[localMethod doSomethingWith:userSelectionFromPicker]
userSelectionFromPicker
被设为视图控制器的属性(与局部变量相反)并由视图控制器的委托访问 - 通常在视图控制器被关闭时userSelectionFromPicker
更改时调用通知In Xcode, connect the datasource & delegate outlets to the UIViewController that contains the UIPickerView. The datasource methods are declared in the UIViewController implementation. Let's say your picker will display: "English" and "French":
The delegate methods are also declared in the UIViewController implementation:
Some examples of how
userSelectionFromPicker
can be used to perform an action in the app:[localMethod doSomethingWith:userSelectionFromPicker]
userSelectionFromPicker
is made a property of the View Controller (as opposed to a local variable) and accessed by the View Controller's delegate - often when the View Controller is dismisseduserSelectionFromPicker
changes