Question

i am making an application based on photography as per the requirement i have to show all progress or activity indicator in a menner to look it like opening camera shutter.

For better explanation see attached image.

enter image description here

As shown in image while loading closed shutter of camera should rotate and after loading message should come after opening camera shutter.

Please tell me how to achieve this kind of animation..

EDIT: i got a code from This Question. I have used this code like this

-(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"];

}

But it gave me square animation i want this animation in round shape. see attached image.

enter image description here

I tried to give corner radius to this layer like

[[[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]];

But this code dosent work.... Please guide me how to make this animation in circular shape.

Was it helpful?

Solution

To make your SQUARE UIImageView circular:

CALayer *imageViewLayer = [imageView layer];
[imageViewLayer setMasksToBounds:YES];
[imageViewLayer setCornerRadius:imageView.frame.size.height/2];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top