Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I check for a specific UITextField out of many?
    primarykey
    data
    text
    <p>Original question: I have 3 UITextFields (nameField, locationField, and discriptionField) I need to have a if statement trigger on discriptionField only, however the way I have tried it (configured below) all 3 textfields perform setViewMovedUp. I have also tried if([sender isEqual: discriptionField]) but I'm getting the same problem, all 3 textfields preform the method. </p> <pre><code>-(void)textFieldDidBeginEditing:(UITextField *)sender { if (sender == discriptionField) { //move the main view, so that the keyboard does not hide it. if (self.view.frame.origin.y &gt;= 0) { [self setViewMovedUp:YES]; } } } </code></pre> <p>My Solution: Beginner mistake, I was calling that same method from another method without realizing it. Probably a poor way to solve the problem but here is my solution. </p> <pre><code>BOOL onlyDiscription = NO; -(void)textFieldDidBeginEditing:(UITextField *)sender { if ([sender isEqual:discriptionField]) { //move the main view, so that the keyboard does not hide it. if (self.view.frame.origin.y &gt;= 0) { [self setViewMovedUp:YES]; onlyDiscription = YES; } } } -(void)keyboardWillShow { if (onlyDiscription) { // Animate the current view out of the way if (self.view.frame.origin.y &gt;= 0) { [self setViewMovedUp:YES]; } else if (self.view.frame.origin.y &lt; 0) { [self setViewMovedUp:NO]; } } } -(void)keyboardWillHide { if (onlyDiscription) { if (self.view.frame.origin.y &gt;= 0) { [self setViewMovedUp:YES]; } else if (self.view.frame.origin.y &lt; 0) { con = YES; [self setViewMovedUp:NO]; } onlyDiscription = NO; } } </code></pre>
    singulars
    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.
    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