如何在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:51:53  来源:igfitidea点击:

How to use UIPickerview in xcode 4.2 storyboard?

xcodexcode4.2uipickerviewstoryboard

提问by user1123878

I am trying to use a UIPickerViewfor 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 的过程

UIPickerView - How to populate

UIPickerView - 如何填充

回答by Peter DeWeese

I verified and it behaves the same for storyboards as it does for xib files. After adding the UIPickerViewto a view, right click it to reveal the delegateand datasourceoutlets. Double check that your UIViewControllerfor the view is a UIPickerViewDataSourceand UIPickerViewDelegate, or you will not be able to attach these outlets unless it is.

我验证了它对于故事板的行为与对于 xib 文件的行为相同。添加UIPickerView到视图后,右键单击它以显示delegatedatasource出口。仔细检查您UIViewController的视图是否为UIPickerViewDataSourceand UIPickerViewDelegate,否则您将无法连接这些插座,除非它是。