How to make sure the UIView -drawRect: is drawing with contentScaleFactor of 1.0f?

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

  •  29-09-2019
  •  | 
  •  

문제

I've implemented -drawRect: to draw something, and I don't want that this drawing happens on a larger bitmap on the retina display. How can I make sure that this bitmap is always exactly the same across all devices?

I tried to set self.contentScaleFactor = 1.0f; in the initialzier but that didn't help. The system seems to change this back to 2.0f automatically... In my NSLog I keep getting

contentScaleFactor = 2.0f

How to make sure it's 1.0f?

도움이 되었습니까?

해결책

Probably a bit late, but if anyone needed...

-(void) layoutSubviews {
    [super layoutSubviews];
    self.contentScaleFactor = 1
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top