我正在编写iPhone编程器,并且
我想使按钮旋转180度,我尝试使用多点触控板旋转UIbutton,但操作不成功,该怎么办?还是我需要通过代码来完成?

最佳答案

好吧,我们开始:

CABasicAnimation *halfTurn;
halfTurn = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
halfTurn.fromValue = [NSNumber numberWithFloat:0];
halfTurn.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
halfTurn.duration = 0.5;
halfTurn.repeatCount = 1;
[myButton addAnimation:halfTurn forKey:@"180"];


希望对您有帮助...虽然我是从PC而不是Mac输入的,所以我希望是对的!

关于iphone - 如何在Xcode + IB中旋转UIbutton?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2455334/

10-10 12:28