Guest User

Untitled

a guest
May 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. - (void)textFieldDidBeginEditing:(UITextField *)textField{
  2. NSLog(@"Se abrio el teclado");
  3. tmpRect = self.tableView.frame;
  4.  
  5. [UIView beginAnimations:@"shrinkingTheTableView" context:nil];
  6. [UIView setAnimationCurve:UIViewAnimationCurveLinear];
  7. [UIView setAnimationDidStopSelector:@selector(finishedShrinkingTheTableView:finished:context:)];
  8. [UIView setAnimationDuration:0.25]; //I think .25 is the keyboard appearing animation duration
  9. self.tableView.frame = CGRectMake(tmpRect.origin.x, tmpRect.origin.y, tmpRect.size.width, tmpRect.size.height - 200);
  10. [UIView commitAnimations];
  11.  
  12. }
  13.  
  14. - (void)finishedShrinkingTheTableView:(NSString*)animationID finished:(BOOL)finished context:(void *)context {
  15. [self.tableView scrollToRowAtIndexPath:whateverTheIndexPathIs atScrollPosition:UITableViewScrollPositionTop animated:YES
  16. }
Add Comment
Please, Sign In to add comment