Can I set the scaleFactor of an UIView when I want my drawing code in -drawRect to not waste too much memory?

StackOverflow https://stackoverflow.com/questions/3777515

문제

I am drawing something into -drawRect of an UIView, and in this case I really want a certain amount of pixels. With the retina display, my view has a scaleFactor of 2.0 and when I draw something that is supposed to be 10 pixels heigh, it's actually 20 heigh. Is it okay to set the scale factor back to 1.0 to get a 1:1 mapping between points and pixels?

도움이 되었습니까?

해결책

The official documentation says it's ok.

See 'Accounting for Scale Factors in Core Animation Layers' in 'iOS Application Programming Guide' for details.

다른 팁

Wrong guide - try the section "Accounting for Scale Factors in Core Animation Layers", in "Drawing and Printing Guide for iOS"

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