我有一个视图1.导航栏2.UITableView 3.UITextView。当键盘出现时将UITextField和UITableView向上移动
当我开始编辑textView时,出现一个键盘,我需要为TextView和TableView设置动画。我已经实现了:https://stackoverflow.com/a/8704371/1808179,但是将整个视图动起来,覆盖导航栏。
我试过单独动画TextView的,如:
- (void)keyboardWillShow:(NSNotification*)notification
{
CGRect chatTextFieldFrame = CGRectMake(chatTextField.frame.origin.x,chatTextField.frame.origin.y-218,chatTextField.frame.size.width,chatTextField.frame.size.height);
[UIView animateWithDuration:0.5 animations:^{ chatTextField.frame = chatTextFieldFrame;}];
}
不过,这并不动画,并且它不会同步动画旁边的TableView中。
什么是最好的方式来动画的tableView和textView没有覆盖导航栏?
您是否尝试更改表高而非原点? – Wain
@Wain这似乎工作。谢谢! – Spenciefy