我对 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/