문제

I have an view inside a UIScrollView. On that view I set a scale transform, so it compensates for the zooming and stays the same size.

While the transform seems to work on all subviews, filling the bounds in the view's own drawRect seems to fill the whole frame, as if there was no scale transform applied.

Why can this be?

도움이 되었습니까?

해결책

I was aware that I could not use the frame property in a transformed view, but actually setting it yourself on a transformed view is also a no-no.

if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified

I removed all code that uses self.frame in any way and used self.center instead. Now everything displays correctly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top