I'm running this code to shrink a UIView when the user taps on its superview. However, when applying the CGAffineTransformScale(), it also changes the centre. Is that the expected behaviour?
-(void) onTap:(UITapGestureRecognizer *)tap{
[UIView animateWithDuration:1.2
delay:0
options:0
animations:^{
CGAffineTransform transform = self.icon.transform;
NSLog(@"Previous center: %@", NSStringFromCGPoint(self.icon.center));
self.icon.transform = CGAffineTransformScale(transform, 0.5, 0.5);
NSLog(@"Next center: %@", NSStringFromCGPoint(self.icon.center));
} completion:^(BOOL finished) {
//
}];
}
I finally found out what was going on: Autolayout was repositioning the subview and changing the center.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With