Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPickerView Animation Hide and Show Failed
    text
    copied!<p>I have this on my interface file :</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface ViewController : UIViewController &lt;UIPickerViewDataSource, UIPickerViewDataSource&gt; // PickerView Array @property (strong, nonatomic) NSArray *pickerNames; @property (strong, nonatomic) NSArray *pickerValues; @property (strong, nonatomic) IBOutlet UIPickerView *picker; - (IBAction)buttonSelectPicker; @end </code></pre> <p>and I have this on my implementation file :</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // PickerView Array _pickerNames = @[@"Data1", @"Data2", @"Data3", @"Data4", @"Data5"]; _pickerValues = @[@"val1", @"val2", @"val3", @"val4", @"val5"]; _picker.frame = CGRectMake(0, 1000, 320, 216); } </code></pre> <p>all of those code works perfectly on my iPod (iOS 6.1.3) now, I have problems with what actually I want to do more... they are...</p> <ol> <li><p>when the app loaded for the first time, UIPickerView is hidden (outside the screen area). I tried by adding this line (on <code>viewDidLoad</code>) but it didn't work.</p> <p><code>_picker.frame = CGRectMake(0, 1000, 320, 216);</code></p></li> <li><p>then when user tap the <code>buttonSelectPicker</code> button, UIPickerView shows up. this lines of code also didn't work :</p> <p><code>- (IBAction)buttonSelectPicker { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.3]; _pickerviewContainer.frame = CGRectMake(0, 289, 320, 216); [UIView commitAnimations]; }</code></p></li> <li><p>and when user tap anywhere outside UIPickerView area, it will hide the UIPickerView. I have this code to dismiss keyboard, but I don't know how to modify to dismiss UIPickerView :</p> <p><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UIView * txt in self.view.subviews){ if ([txt isKindOfClass:[UITextField class]]) { [txt resignFirstResponder]; } } }</code></p></li> </ol> <p>thank you...</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