【发布时间】:2009-09-18 08:03:39
【问题描述】:
我正在寻找一种方法来使我的(第一个)应用程序的菜单系统滚动更顺畅。目前,我在 IB 中构建了一个全景类型视图,它的图像宽约 1900 像素,高图像高 480。 On top of this are 8 buttons in various places along the view/image, when one of the buttons is selected i update 'xPoint' and call the below to update what's on screen (between 400-600px movement each time a button gets clicked in 1-2 秒持续时间):
-(void)moveView:(NSNumber *)duration{
[UIView beginAnimations:nil context:NULL];{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:[duration floatValue]];
[UIView setAnimationDelegate:self];
viewRect = self.view.frame;
viewRect.origin.x = xPoint;
self.view.frame = viewRect;
} [UIView 提交动画];
}
我已将 IB 中的所有内容设置为不透明,并且未选中每个按钮/图像的“绘制前清除上下文”。在 3GS 上,这似乎比 3G 设备更流畅,但仍然不完美——动画仍然卡顿。
有没有更好的方法来做到这一点?如果没有,有什么办法可以优化/平滑运动动画?
【问题讨论】:
-
每个视图的维度最多应为 1024。如果超过此值,就会发生奇怪的事情
标签: objective-c iphone