I have a UIScrollView
with a UIView
as a subview. The UIView
has a bunch of data entry fields arranged vertically - essentially just a fixed format data entry Form.
I want to keep the UIView's
vertical size and adjust its horizontal size to match the size of the UIScrollView
which changes depending on the orientation of the device. Note that this is all placed in the Detail view of a UISplitViewController
.
So the user will have to scroll vertically but not horizontally as all the text fields on the UIView
should resize themselves to fit horizontally on the screen.
Currently if I resize the UIView
by changing the frame width to match the UIScrollView's
frame width then the UIView
subviews (the text fields) don't resize themselves according to the constraints setup in IB. The UIView
just seems to get clipped. There is no horizontal scrolling so this aspect is working correctly.
I have autoresize subviews set on UIView
and on UIScrollView
.
Any tips on what to do here ? Also where would I put code to resize the UIView
if the device orientation changes ?
Additional information.
I created the UIView
in IB as a separate view in the same NIB as the DetailViewController
containing the UIScrollView
. Because it is much taller than the UIScrollView
the only way I can find for creating it in IB is if I set it up as a separate view of the desired width and height. I then create an IBOutlet and add this view as a subview to UIScrollView
in the viewDidLoad
method. This all seems to work find with the views all displaying correctly, with the exception that the UIView
subviews are not resized horizontally.
Any suggestions on what I may be doing wrong here?