简体   繁体   中英

Swift: rotate imageView around left side

I have this code to rotate imageView around its axis (center of image):

transform.m34 = 1.0 / -2000.0
self.imageRevealed1.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), 0.0, 1.0, 0.0)

But I need rotate imageView around its left side. How to do it?

You should modify the view anchorPoint before set the layer transform. Example, in your case, the anchorPoint should set CGPoint(x: 0, y: 0.5) , then set transform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM