2

I am try to develop an application involving text views. If I use the 4 inch size, it goes out of the screen on 3.5 inch devices. If I change the size to 3.5 inch, fix it and change it back to 4 inch, there is this big, ugly gap above the text view.

I think the solution to this problem is multiple view controllers. One for the 3.5 inch and one for the 4 inch. But how would I do this? I am using Xcode 5, developing for iOS 7 and testing on an iPhone 4.

Thanks, Romejanic

Cœur
  • 37,241
  • 25
  • 195
  • 267
Romejanic
  • 419
  • 1
  • 4
  • 9
  • I'd recommend reading about [auto layout](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html) - it'll save you a lot of pain. – John Parker Sep 21 '13 at 06:45

2 Answers2

1

You dont have to use two view controllers. All you need are some Auto Layout Constraints or autosizing mask to resize your view for different screen sizes. Below are some helpful links.

Tutorial about auto layouts:

Part 1: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2

Part 2: http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2

Working with Constraints in Interface Builder https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraints/WorkingwithConstraints.html#//apple_ref/doc/uid/TP40010853-CH8-SW1

Apple Auto Layout Guide https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html

A similar question about how to set auto layout constraints for 4 and 3.5 inches screens Resize view with Auto Layout between 3.5 and 4 inch form factor

Community
  • 1
  • 1
Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
0

If you are using .xib to create your UI then in the size inspector there is an Autosizing feature. You can hold the lower and upper bound for the text view and stretch the text view,i.e, click on the vertical arrow in the middle of the box. This will auto resize your text view according to your device height.