Alex Stone
Alex Stone

Reputation: 47348

iPhone iOS large UIView gets clipped to 320x460 when displayed. How to prevent?

I have a 850x1100 UIView defined in a storyboard it is 4 times the size of a normal window, and I'm using it as a PDF generation template. The view is wrapped within a scrollview. Yet when I display the view, its frame gets resized and becomes 320x460, effectively cutting off everything outside the frame.

Does anyone have insight on why my UIView defined in a storyboard as 850x1100 gets its frame reset to 320x460 when displayed on an iPhone?

Upvotes: 2

Views: 1121

Answers (2)

bbrodjes
bbrodjes

Reputation: 66

This frame recalculation is not a bug. The frame of a view represents its position and size relative to the screen coordinates.

The iPhone viewing area is 320x480 and any view that has its frame set to a CGRect larger than the viewing area of the device will become "clipped" and have its frame set back to the viewing area (320x460 viewing area due to the status bar).

Try:

scrollView.contentSize = CGSizeMake(850,1100);
scrollView.clipsToBounds = NO;
pdfView.clipsToBounds = NO;

Upvotes: 3

Tom van der Woerdt
Tom van der Woerdt

Reputation: 29975

Are you sure it's not the scrollview whose contentsize is too small? It won't automatically resize based on the content - you have to explicitly set the contentSize of the UIScrollView

Upvotes: 1

Related Questions