0
我有一個UIImageView(100x100px),當用戶點擊圖像時,我想要做一個動畫,將圖像全屏顯示。問題與動畫和子視圖
該動畫是將框架更改爲全屏和CABasicAnimation旋轉圖像的組合。
我已經設置這樣的:
[self.view bringSubviewToFront:imageView];
CGRect originalFrame = CGRectMake(20.0, 20.0, 100.0, 100.0);
CGRect fullFrame = CGRectMake(0.0, 0.0, 320.0, 320.0);
CGRect newFrame = (isImageFullScreen ? originalFrame : fullFrame);
CABasicAnimation* spinAnimation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.y"];
spinAnimation.duration = 0.5;
spinAnimation.toValue = [NSNumber numberWithFloat:2*M_PI];
[imageView.layer addAnimation:spinAnimation forKey:@"spinAnimation"];
[UIView animateWithDuration:0.6
delay:0.25
options:UIViewAnimationOptionTransitionNone
animations:^{
imageView.frame = newFrame;
button.frame = newFrame;
}
completion:nil];
問題是與旋轉的動畫。 在我看來,還有一些其他的子視圖在圖像旋轉時保持在最前面。
如何使這項工作,使圖像動畫在我的其他子視圖之上?