CGAffineTransform and scaling to center of the image

后端 未结 3 896
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 02:16

I started studying objective-c using the iPhone and iPad apps for Absolute Beginners by Rory Lewis book but i got stuck on the 5th chapter.

I want to make a

3条回答
  •  不知归路
    2021-01-12 02:50

    If you are transforming a view mangled managed by auto-layout, you may experience some strange side-effects. See this answer for more details.

    The solution I ended up employing was to encapsulate the view I wanted to transform inside another view of exactly the same size. The outer view had the appropriate layout constraints applied to it while the inner view was simply centered in its container. Applying a CGAffineTransform scale transform to the inner view now centers properly.

提交回复
热议问题