简体   繁体   中英

change color of shutter animation iphone

I am making a photography based application i have used a shutter animation for progress.

here is my code..

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self performSelector:@selector(makeRound) withObject:nil afterDelay:2.0];
}
-(void)makeRound
{
    [[[self.view viewWithTag:90] layer] setMasksToBounds:YES];
    [[[self.view viewWithTag:90] layer] setCornerRadius:75.0];
    [[[self.view viewWithTag:90] layer] setBorderWidth:2.0];
    [[[self.view viewWithTag:90] layer] setBorderColor:[[UIColor blackColor] CGColor]];
    [(UILabel *)[[self.view viewWithTag:90] viewWithTag:991] setText:@"Loading.."];
    [self shutter];
}
-(void)shutter
{
    CATransition *shutterAnimation = [CATransition animation];
    [shutterAnimation setDelegate:self];
    [shutterAnimation setDuration:1.5];
    [shutterAnimation setType:@"cameraIris"];
    [shutterAnimation setValue:@"cameraIris" forKey:@"cameraIris"];
    [shutterAnimation setRepeatCount:1];
    [[[self.view viewWithTag:90] layer] addAnimation:shutterAnimation forKey:@"cameraIris"];
}
-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
    [self performSelector:@selector(shutter) withObject:nil afterDelay:0.5];
}

and my output is like this.

在此处输入图片说明

but i want to change this black color of shutter.Please share your knowledge and help me.

Unless the camera iris exposes a " color " property, I'm pretty certain you won't be able to change the color of the iris blades to anything arbitrarily. That artwork is built into the OS and is static.

If you are set on changing the color of the iris blades, you may need to do your own animation with your own graphics ( which other people have had to do, too ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM