gpt4 book ai didi

iphone - 如何旋转imageview而不卡顿?

转载 作者:行者123 更新时间:2023-11-29 03:51:04 26 4
gpt4 key购买 nike

我正在我的应用程序中集成指南针,但问题是旋转它时 ImageView 滞后。我怎样才能解决这个问题并使其像苹果的应用程序一样以良好的方式旋转?

这是我正在使用的代码:

float heading = -1.0f * M_PI * degree / 180.0f;
[UIView animateWithDuration:1.0f delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.compassImageView.transform = CGAffineTransformMakeRotation(heading);
} completion:nil];

这是指南针:

http://i.stack.imgur.com/JXF9A.png

最佳答案

只需去掉 animateWithDuration 持续时间即可。你不需要它。我猜你想要它,因为你希望运动平滑,但我有一个类似的应用程序,可以显示滚动和俯仰,我只是调用

tiltImage.transform = CGAffineTransformMakeRotation(DegreesToRadians(angle));

并且移动平稳。

你想多了。 (JustSid 是对的。)

关于iphone - 如何旋转imageview而不卡顿?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17052076/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com