iphone - iOS - Core Animation - How to set origin when transform property is changed -
I have a UIView as a subview in its original view. When the user taps this
UIView , I want to change it, so it takes the whole screen.
I changed it to
property and I was able to match its size to my original view, but its not the position.
I read an Apple document and found
frames can not be used with
.
In addition, using a
transform is a good idea to do so by altering your barriers, like,
NSLayoutAutriteHit ?
I think you can change the frame after changing it like this:
// I am using 5 for the test purpose. BackgroundImageView.transform = CGAffineTransformMakeScale (5, 5); Self.backgroundImageView.frame = CGRectMake (0, 0, self.backgroundImageView.frame.size.width, self.backgroundImageView.frame.size.height); Or change the anchor point before scale:
self.backgroundImageView.layer.anchorPoint = CGPointMake (0.5, 0.5); Self.backgroundImageView.transform = CGAffineTransformMakeScale (5, 5); If you use Autolayout in your UIView, then its solution depends on how you set up your obstacles, for example, if you set your image barriers like this:
I would suggest conversion on scale , But change the top and left handicap to 0.
Or you set up your image barrier like this:
I will change center alignment x and y to the center point of the super alignment
Perhaps you can tell me how you have set the barriers, I I can do some tests for you at my local level.
Comments
Post a Comment