解决方法
所以在我按下后,我突然把两个和两个放在一起,并认为Metronome样品的工作类似于一个摆动的门,这让我有了一些其他的可能性.
这是我的解决方案:
- (void)viewDidLoad { [super viewDidLoad]; // Set the anchor point and center so the view swings from the upper right swingView.layer.anchorPoint = CGPointMake(1.0,0.0); swingView.center = CGPointMake(CGRectGetWidth(self.view.bounds),0.0); // Rotate 90 degrees to hide it off screen CGAffineTransform rotationTransform = CGAffineTransformIdentity; rotationTransform = CGAffineTransformRotate(rotationTransform,DegreesToRadians(90)); swingView.transform = rotationTransform; } ... - (void)animateSwing { CGAffineTransform swingTransform = CGAffineTransformIdentity; swingTransform = CGAffineTransformRotate(swingTransform,DegreesToRadians(0)); [UIView beginAnimations:@"swing" context:swingView]; [UIView setAnimationDuration:0.25]; swingView.transform = swingTransform; [UIView commitAnimations]; }
希望这也有助于其他人!