Question

I have a view which has a few subviews. I am using transforms to scale the view 400%, which works perfectly, but I am not sure how to scale the "drawing" of the sub-views. So when I render the scaled view the subviews come out fuzzy because their drawing is still at 100%.

I have tried [view setNeedsDisplay] on the view and its subViews, but the drawing is still low resolution.

Any ideas on how to fix this render?

Was it helpful?

Solution

Try:

CGFloat myScale = 4.0;
[view setContentScaleFactor:myScale*[[UIScreen mainScreen] scale]]];

Additionally, if you were embedding your view within a UIScrollView to allow the user to zoom in/out you could put this implementation in your UIScrollViewDelegate:

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
    scale *= [[[scrollView window] screen] scale];
    [view setContentScaleFactor:scale];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top