如何在 xcode 4.2 故事板中使用 UIPickerview?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8686030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use UIPickerview in xcode 4.2 storyboard?
提问by user1123878
I am trying to use a UIPickerView
for my project but I can't figure out how to use them in the storyboard format. Does anyone know how to do that?
我正在尝试将 aUIPickerView
用于我的项目,但我不知道如何在故事板格式中使用它们。有谁知道这是怎么做到的吗?
回答by Kevin Burandt
This post takes you through the process w/xcode 4.2
这篇文章将带您完成使用 xcode 4.2 的过程
回答by Peter DeWeese
I verified and it behaves the same for storyboards as it does for xib files. After adding the UIPickerView
to a view, right click it to reveal the delegate
and datasource
outlets. Double check that your UIViewController
for the view is a UIPickerViewDataSource
and UIPickerViewDelegate
, or you will not be able to attach these outlets unless it is.
我验证了它对于故事板的行为与对于 xib 文件的行为相同。添加UIPickerView
到视图后,右键单击它以显示delegate
和datasource
出口。仔细检查您UIViewController
的视图是否为UIPickerViewDataSource
and UIPickerViewDelegate
,否则您将无法连接这些插座,除非它是。