0

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.

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
Namratha
  • 16,630
  • 27
  • 90
  • 125

1 Answers1

0

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.

Interface Builder screenshot

Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229