Search code examples
iosobjective-cuiviewanimationfacebook-pop

Facebook pop kPOPLayerCornerRadius is not working


I have outlet from storyboard and pop animation code inside of IBaction (UIButton) :

@property (strong, nonatomic) IBOutlet UIView *animationView;
...
...
POPBasicAnimation *animationCircle = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerCornerRadius];
animationCircle.toValue = @(self.animationView.layer.cornerRadius/2);
animationCircle.name = @"animacijaCircle";
animationCircle.delegate = self;
[self.animationView pop_addAnimation:animationCircle forKey:@"animacijaCircle"];

My animation is not working and I don't know why...

I have this in my debug area:

2015-03-17 11:28:00.321 customControll[5759:325909] -[UIView cornerRadius]: unrecognized selector sent to instance 0x7fc79ac720c0

and my exception breakpoint os stoped on this part of pop framework:

{kPOPLayerCornerRadius,
^(CALayer *obj, CGFloat values[]) {
  values[0] = [obj cornerRadius];// exception breakpoint is on this line here
},
^(CALayer *obj, const CGFloat values[]) {
  [obj setCornerRadius:values[0]];
},
kPOPThresholdRadius}

You can also give me example of cornerRadius animation with pop that I can use, I just want to make it work with Facebook pop.

Thank you!


Solution

  • kPOPLayerCornerRadius is a layer property not a view property therefore you need to add the animation to the layer not the view. So this line:

    [self.animationView pop_addAnimation:animationCircle forKey:@"animacijaCircle"];
    

    should be:

    [self.animationView.layer pop_addAnimation:animationCircle forKey:@"animacijaCircle"];