我根据要求制作基于摄影的应用程序我必须以一种方式显示所有进度或活动指示器,看起来像打开相机快门。
有关更好的说明,请参阅附图。
如图所示,在加载关闭的相机快门时应旋转,加载后应在打开相机快门后发出信息。
请告诉我如何实现这种动画..
编辑:我从This Question获得了一个代码。我使用过这样的代码
-(void)shutter
{
CATransition *shutterAnimation = [CATransition animation];
[shutterAnimation setDelegate:self];
[shutterAnimation setDuration:1.5];
shutterAnimation.timingFunction = UIViewAnimationCurveEaseInOut;
[shutterAnimation setType:@"cameraIris"];
[shutterAnimation setValue:@"cameraIris" forKey:@"cameraIris"];
[shutterAnimation setRepeatDuration:4.5];
[[[self.view viewWithTag:90] layer] addAnimation:shutterAnimation forKey:@"cameraIris"];
}
但它给了我方形动画我希望这个动画呈圆形。见附图。
我试图给这个层提供角半径,如
[[[self.view viewWithTag:90] layer] setCornerRadius:75.0];//size of this view is 150X150 so i give radius 75 to make it round.
[[[self.view viewWithTag:90] layer] setBorderWidth:2.0];
[[[self.view viewWithTag:90] layer] setBorderColor:[[UIColor blackColor] CGColor]];
但这段代码有效...... 请指导我如何制作圆形动画。
答案 0 :(得分:3)
使你的SQUARE UIImageView循环:
CALayer *imageViewLayer = [imageView layer];
[imageViewLayer setMasksToBounds:YES];
[imageViewLayer setCornerRadius:imageView.frame.size.height/2];