Suppose I have 2 ViewControllers A and B. Properties:
- A is a rectangle (where its height > its weight)
- B is a rectangle (where its height > its weight)
I want to do the following process:
- Turn A into a SMALL (perfect) CIRCLE
Move A to the right bottom of the screen, like this:
____ | | | | | | |___O| about 9/10 of the height and of the width
(both operations can be done at the same time, no problems with that.
To pass A to B, I took a print from A's screen and passed it to B as an UIImage, through a segue.
Then B shows A immediatly. This way I migrate from A to B.
The problem is: How do I turn the A UIImage (rectangular) into a PERFECT CIRCLE and the move to some given position in B (using animateWithDuration)? I couldnt turn it to a perfect circle (using only cornerRadius) and couldn't move it correctly after I make the CGAffineTransformMakeScale operation.
PS: before doing these operations, I turned the UIImage to an UIImageView.
Here is my animation code,
//imageTestte is the UIImageView
self.imageTestte.layer.masksToBounds = TRUE;
_imageTestte.layer.cornerRadius = _imageTestte.bounds.size.width/2;
CGFloat h = _imageTestte.frame.size.height;
CGFloat w = _imageTestte.frame.size.width;
CGRect r = CGRectMake(0, 0, w, w);
[UIView animateWithDuration: 2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
//_imageTestte.bounds = r;
//this line above is to turn it to a square
_imageTestte.transform = CGAffineTransformMakeScale(0.15f, 0.15f);
_imageTestte.center = CGPointMake(self.view.frame.size.width * (9.0/10.0), self.view.frame.size.height* (9.0/10.0));
} completion:^(BOOL finished) {
}];