我正在使用带有 block 的动画,并且我正在尝试对主窗口框架的更改进行动画处理。 这是我的代码:
[UIView animateWithDuration:0.3f animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.view.window.frame = CGRectMake(0.0f, -20.0f, self.view.window.frame.size.width, self.view.window.frame.size.height+20);
}];
但是它不会像 self.view.frame 更改或其他东西那样进行动画处理。这只是没有动画的垃圾。
有什么想法吗?
最佳答案
这是错误的,窗口在框架和边界中是固定的, 您无法移动 Window,它的顶部根容器并且具有恒定的大小,您应该仅像这样平移和转换您的 View 。
[UIView animateWithDuration:0.3f animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.view.frame = CGRectMake(0.0f, -20.0f, self.view.frame.size.width, self.view.frame.size.height+20);
}];
关于iphone - 动画 self.view.window.frame 变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13532822/