How to make sure UIView -drawRect: draws with contentScaleFactor 1.0f?

I implemented -drawRect: to draw something, and I don’t want this drawing to happen on a larger retina bitmap. How can I make sure that this bitmap is always the same for all devices?

I tried to install self.contentScaleFactor = 1.0f;in initialzier, but that did not help. The system seems to automatically return this back to 2.0f ... In my NSLog, I always get

contentScaleFactor = 2.0f

How to make sure it is 1.0f?

+3
source share
1 answer

Maybe a little late, but if someone needs to ...

-(void) layoutSubviews {
    [super layoutSubviews];
    self.contentScaleFactor = 1
}
+3
source

Source: https://habr.com/ru/post/1768786/


All Articles