ios - UIView beginAnimations 在自定义属性上太快

标签 ios uiview core-animation

我对 UIButton 进行子类化以创建我自己的 UIRoundButton。我正在尝试为名为 radius 的自定义属性设置动画。它确实会改变,但会立即改变。我尝试将动画持续时间增加到 5000,但动画仍然以毫秒为单位发生。

这是代码:

UIRoundButton *tempItem = [self.buttons objectAtIndex:currentElement];
[tempItem setInnerColor:UIColorFromRGB(0xcdcdcd)];

currentElement = currentElement + 1;
UIRoundButton *tempItem2 = [self.buttons objectAtIndex:currentElement];
[tempItem2 setInnerColor:UIColorFromRGB(0xff0000)];

[UIView beginAnimations:@"ToggleViews" context:nil];
[UIView setAnimationDuration:5000];
tempItem.radius = 20;
tempItem2.radius = 40;
[UIView commitAnimations];

有什么想法吗?

最佳答案

隐式 View 动画不适用于自定义属性。如果您想要这种行为,您必须在 CALayer 级别执行此操作。

关于ios - UIView beginAnimations 在自定义属性上太快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10919819/

相关文章:

objective-c - 播放声音与显示的图像一一对应

cocoa - 使用其他应用程序的 View 作为 CoreAnimation Layer

macos - 来自 CA_DEBUG_TRANSACTIONS 的更长回溯

c# - MonoTouch 从 subview 设置位置

iOS。有没有人找到 KeyFrame UIView 属性的方法?

ios - 以编程方式向 UIView 添加约束

ios - 拍摄隐藏的 UIView 的快照

ios - 如何在 TableViewController 中使用 indexPathForItemAtPoint?

objective-c - 单元测试前备份CoreData

iphone - insertRowsAtIndexPaths 为每一行调用 cellForRowAtIndexPath