I am trying to make a simple animation of moving a frame from two views. Basically hiding an ad before loading it, and then moving the frame from the bottom, as well as the view that starts from the bottom, and then moves up when the ad clicks it. The start and end positions are correct, but I donβt see them being animated. It's right? Thanks.
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"frame"]; animation.duration = 1.0; CGRect adFrame = CGRectMake(self.adBanner.frame.origin.x, self.adBanner.frame.origin.y - self.adBanner.frame.size.height, self.adBanner.frame.size.width, self.adBanner.frame.size.height); self.adBanner.frame = adFrame; [self.adBanner.layer addAnimation:animation forKey:@"frame"]; CGRect buttonViewFrame = CGRectMake(self.ButtonView.frame.origin.x, self.adBanner.frame.origin.y - self.adBanner.frame.size.height, self.ButtonView.frame.size.width, self.ButtonView.frame.size.height); self.ButtonView.frame = buttonViewFrame; [self.ButtonView.layer addAnimation:animation forKey:@"frame"];
source share