Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to look up some documentation on how to make a UIPickerView. There are tons of tutorials out there, even video tutorials. Just search around. It's part of becoming a good programmer. I personally would set up my picker in interface builder, and set up an IBOutlet to it. I would then, in the .h file of your viewController, set up a method called -(IBAction)showPicker Them link the method to your button. In your .m file of your viewController you should have</p> <pre><code>-(IBAction)showPicker { [UIView beginAnimations];//tells the compiler to start a new animation [UIView setAnimationDuration:1.0];//in seconds thepicker.frame = CGRectMake(100, 100, 200, 200);//move the picker to a specific position [UIView commitAnimations];//tells the compiler to start the animations } </code></pre> <p>the beginAnimations and commitAnimations is the code that says any code between us will be animated. So you can animate their alpha (transparency), their positions, and others as well. thepicker refers to your IBOutlet name, whatever you called your picker. I would move the picker out of the screen in your interface builder, then when you press the button, move it into postion with</p> <p>thepicker.frame = CGRectMake(x,y,width,height);</p> <p>then, to move it away, just use the same code but change the frame to be out of the screen when you animate it.</p> <p>BTW, I would create your pickerView first in the viewdidload method, instead of creating it on tapping the button. Otherwise, you will constantly be creating UIPickerViews everytime the button is hit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload