setFrame:iOS7中的CGRectOffset行为不一致8

时间:2015-03-27 15:59:12

标签: ios iphone

我使用以下内容:

const int movementDistance = textField.frame.origin.y;
const float movementDuration = 0.3f; // tweak as needed

int movement = (up ? -movementDistance : movementDistance);

[UIView beginAnimations:nil context: nil];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: movementDuration];

[scrollView setFrame:CGRectOffset(scrollView.frame, 0, movement)];

[UIView commitAnimations];

在键盘覆盖文本字段时向上滚动视图。

但是,我注意到在iOS 8中它根本不起作用,但在iOS7中运行正常。

iOS 7 scrolling

iOS 8 scrolling

0 个答案:

没有答案