Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPicker and Keyboard conflict
    primarykey
    data
    text
    <p>what i have is 3 textFields and whenever i touch textField1 or textField2 Picker changes values and there is no keyboard. When i touch textField3 keyboard appears and the picker goes hidden.Now if i dismiss the keyboard by clicking return and then click textField1 picker appears again, but if i dont dismiss the keyboard BY CLICKING BUTTON it stays over the picker. What I need is when the keyboard is firstResponder (and i see it on the screen) to hide it if i click on the textField1 and only to see the picker</p> <pre><code>int variabla; -(void)textFieldDidBeginEditing:(UITextField *)textField{ [pickerView setHidden:YES]; if (textField1.editing == YES) { [textField1 resignFirstResponder]; [pickerView setHidden:NO]; variabla = 1; }else if (textField2.editing == YES) { [textField2 resignFirstResponder]; [pickerView setHidden:NO]; variabla = 2; } NSLog(@"variabla %d",variabla); [pickerView reloadAllComponents]; } - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView; { return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component; { if (variabla == 1) { return [pickerArray1 count]; }else if (variabla == 2) { return [pickerArray2 count]; }else { return 0; } } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; { if (variabla == 1) { return [pickerArray1 objectAtIndex:row]; }else if (variabla == 2) { return [pickerArray2 objectAtIndex:row]; }else { return 0; } } - (void)textFieldShouldReturn:(UITextField *)textField{ [textField resignFirstResponder]; } - (void)viewDidLoad { [super viewDidLoad]; [pickerView setHidden:YES]; pickerArray1 = [[NSMutableArray alloc] initWithObjects:@"0", @"1", @"2", nil]; pickerArray2 = [[NSMutableArray alloc] initWithObjects:@"3", @"4", @"5", nil]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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