I want a text view that'll show up correctly on any device, in any orientation. Currently, I have a text view that is on the top of the view controller, but the top part is cut off when the device is in landscape mode.
I want a text view that'll show up correctly on any device, in any orientation. Currently, I have a text view that is on the top of the view controller, but the top part is cut off when the device is in landscape mode.
Correctly, on any device, in any orientation? I don't think there is a magic way to do that. iPad screens are much bigger than iPhone screens, so a text view that fits perfectly on the iPad won't fit at all on the iPhone.
You could set up the struts and springs to keep the top of your text view pinned to the top of the screen, and the left and right edges pinned to the left and right edges of the screen, with the interior resized automatically. The problem is the height of the view. You could write code in your view controller's viewDidLayoutSubviews method that would adjust the height of the text field once it gets resized for the target device and orientation. That code might look like this:
(Written to assume that the text view is called "bannerTextView".)
There is no guarantee that the text will fit in the text view. You would need to add error-checking code to handle a text view that won't fit in the form.