UIPickerView 连接
我的 UIPickerView 连接有问题。 我的 viewController 类如下所示:
@interface MyViewController: UIViewController <UITextFieldDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
{
IBOutlet UIPickerView *pickerView;/this is what it says in all tutorials
//other textfields
}
@property..of textfields, label, nsstring
@end
在界面生成器中,当我按住 Ctrl 键并单击文件所有者时,我的 pickerview 出现在 Outlet 中,而不是引用的 Outlet 中(与教程中显示的内容相反)。 我如何建立连接?我将它连接到什么? 我希望在单击按钮时显示 PickerView,该按钮的操作也已在上面的类中注册。
I'm having a problem with the connections of UIPickerView.
My viewController class looks like this:
@interface MyViewController: UIViewController <UITextFieldDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
{
IBOutlet UIPickerView *pickerView;/this is what it says in all tutorials
//other textfields
}
@property..of textfields, label, nsstring
@end
In the interface builder, when i ctrl+click on the file's owner, my pickerview appears in Outlets and NOT in referencing outlets(against what is shown in tutorial).
How do I make the connections? and what do I connect it to?
I want the PickerView to be displayed on click of a button whose action is also registered in the above class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你可能只是有一个误会。我创建了一个与您所描述的类似的类:
@interface MyViewController : UIViewController {
UIPickerView *pickerView;
@property
(非原子,保留) IBOutlet UIPickerView *pickerView;
然后我打开了xib。我右键单击文件的所有者(如果没有两键鼠标,则单击 cmd),这将显示 MyViewController 上所有 Outlet 的列表。我发现这比大多数教程建议您按 Ctrl 键单击要容易得多。然后我单击并从 pickerView 旁边的圆圈向下拖动到 pickerView。放开鼠标按钮,它就可以正常连接了。
I think you might just have a misunderstanding. I created a class similar to what you described:
@interface MyViewController : UIViewController {
UIPickerView *pickerView;
}
@property (nonatomic, retain) IBOutlet UIPickerView *pickerView;
Then I opened up the xib. I right-clicked on the File's Owner (or cmd-click if you don't have a two button mouse), which brought up a list of all of the Outlets on MyViewController. I find this a lot easier than the ctrl-clicking that most of the tutorials suggest you do. Then I clicked and dragged from the circle next to pickerView down to the pickerView. Let go of the mouse button and it connects just fine.