开发者

UIPickerView connections

开发者 https://www.devze.com 2023-02-10 06:45 出处:网络
I\'m having a problem with the connections of UIPickerView. My viewController class looks like this: @interface MyViewController: UIViewController <UITextFieldDelegate, UIPickerViewDataSource, UIP

I'm having a problem with the connections of UIPickerView. My viewController class looks like this:

@interface MyViewController: UIViewController <UITextFieldDelegate, UIPickerViewDataSource, UIPic开发者_如何转开发kerViewDelegate>
{
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.


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.

UIPickerView connections

0

精彩评论

暂无评论...
验证码 换一张
取 消