iphone - UIView 动画中的奇怪行为

标签 iphone ios ipad

我在 UIView 动画中遇到了一个奇怪的行为。我正在开发一个使用一些 UIView 动画的 iPad 应用程序。

所有动画的持续时间都设置为 0.5。最初启动应用程序时,所有动画都运行良好。但是在连续使用一段时间后没有动画发生,所有 UIView 变化都在快速发生,就像没有在动画中设置持续时间一样。

我不确定为什么会这样。有没有其他人遇到过这种问题?

以下是我正在使用的动画之一。像这样,我使用了很多动画,但一段时间后没有任何动画发生,但动画 block 中的所有代码都工作正常

[UIView animateWithDuration:0.5 animations:^{ 
    [tempLabel setFont:titleFont.font]; 
    [tempLabel setTransform: CGAffineTransformMakeRotation((-90 * M_PI / 180))]; 
    tempLabel.frame = CGRectMake(2,0,23,30);   
}];

最佳答案

来自UIView class reference , 框架属性:

Changes to this property can be animated. However, if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified. In that case, you can reposition the view using the center property and adjust the size using the bounds property instead.

当您还设置了变换时,不要为框架设置动画。请改用边界和中心。

关于iphone - UIView 动画中的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15652992/

相关文章:

iOS - 检测 Blow into Mic 并转换结果! ( swift )

ios - 使用 Quartz (iOS) 创建 PDF 注释

iphone - QLPreviewController 没有正确显示图片文件的图标

iphone - 如何检查 iPhone 设备上已安装的应用程序

iphone - 如何在提交 iPhone 应用后添加新的应用内购买

iphone - 如何找到 MKMapView 当前的缩放级别?

ios - 如何使用 swift 在 iOS 中的一个项目中使用多个导航 Controller

iphone - 仅在另一个 UIImage 内部移动 UIImage

ios - NSManagedObject 上的属性为空

iphone - Xcode游戏声音可以在Sim和iPad上播放,但不能在iPhone 6上播放