Here's the situation, I'm a newb at this - so I could be totally on the wrong path.
I am building an app with multiple views; in one of those views I need the user to select from a dropdown list (UIPickerView) --> for simplicity let's call that view "PC" which has PC.h and PC.m files.
Through IB I was able to drop a UIPickerView object to the PC view, and I initialize that "object" in my ViewController.h and ViewController.m files. Meaning, I'm able to load the view, populate data in the view, etc. etc.
My challenge/problem is - I want the UIPicker to be hidden until the user clicks a button on the PC view, then I want to show the UI开发者_如何学GoPicker and hide it again once the user selects something from the menu.
I've searched and searched and can't find anything, so any help here is appreciated!
assuming that your UIPickerView instance (object) is called pv;
This is how your header-file may look like:
@interface YourViewController : UIViewController
{
IBOutlet UIPickerView *pv;
}
@property (nonatomic, retain) UIPickerView *pv;
@end
You then need to connect the pv-instance within the InterfaceBuilder to your Picker-View.
Trivial Approach:
somewhere in your viewDidLoad of the embedding view-controller:
pv.hidden = YES;
within the button action method (connected to your button-touch-up-instide event):
pv.hidden = NO;
within the action method of your "menu"
pv.hidden = YES;
精彩评论