动画代码在键盘显示方法中时为什么动画不同?

时间:2017-11-23 03:24:16

标签: ios animation uikeyboard

我想在键盘显示时添加动画,我尝试像这样添加动画

- (void)keyboardWillShow:(NSNotification *)notification {
   _inputTextView.center = CGPointMake(300, 500);

   [UIView animateWithDuration:4 animations:^{
      _inputTextView.center = CGPointMake(300, 100);
   } completion:nil];
}

在动画之前我尝试将textView中心设置为(300,500),但似乎无法正常工作。 enter image description here

如果我将代码移动到按钮点击方法,它可以按我想要的方式工作,就像系统在键盘方法中更改了我的动画一样,任何人都知道原因并告诉我原因?谢谢! enter image description here

0 个答案:

没有答案