0

in my app im tapping on a navigation bar button and as a response i move the view beneath the navigation bar 60 px down (the delta var in the code), and under the view that moves down, appears a UITextField and at the same time show the keyboard.

that's how i achieve it:

-(void)btnSearch_Click:(id)sender{
    float delta = _viewBtnSort.frame.size.height;
    CGRect rect = rectSearch;
    rect.origin.y += delta;

    [UIView animateWithDuration:0.3f animations:^{
       [_viewSearchResults setFrame:rect];
    }completion:^(BOOL finished) {
       [buttonSearch setEnabled:NO];
       [_txtFieldSearch becomeFirstResponder];
}];}

Problem

it works fine for a few times and then for some unexplained reason(couldnt find so far why), when the keyboard appears it pushes my view back up i and i dont get the effect i want.

anybody got any ideas? thanks!

Max
  • 799
  • 1
  • 5
  • 17

1 Answers1

0

so i kept looking for a fix, and did it using this iOS8: What's going on with moving views during keyboard transitions? answer.

i changed my constraint instead of the frame and now it seems to work fine.

Community
  • 1
  • 1
Max
  • 799
  • 1
  • 5
  • 17