Closed Ekulelu closed 7 years ago
I can't help with positioning of elements in a UIButton
, since that doesn't sound related to Pop. However, for your rotation animation, that code looks right to me. Note that Pop simply sets the rotation transform
value as you set it. So try setting the rotation to intermediate values yourself and see if you can reproduce the problem without Pop. That might help narrow down the problem.
I try to rotate the imageView in a button like below. But the button.imageView is rotating diagonal not in the screen plane. Do I make something wrong? Besides, if you change the location of titleLabel and imageView in a button with the UIEdgeInsets, the size(frame) change method also strange. For example, I make the titleLabel below the imageView, and resize the button for zero size to a big size. the button always appears from the right side, not from the center.
//The button self.imgBtn = [[UIButton alloc] init]; [self.imgBtn setImage:[UIImage imageNamed:@"b"] forState:UIControlStateNormal]; [self.view addSubview:self.imgBtn]; self.imgBtn.frame = CGRectMake(100, 100, 200, 200);
//The rotate method POPBasicAnimation anim = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerRotation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; anim.fromValue = @(0); anim.toValue = @(M_PI 2); anim.duration = 1; anim.repeatForever = YES; [self.imgBtn.imageView.layer pop_addAnimation:anim forKey:@"Rotate"];