-2

I have a view with UITextViewat the top UIButton at the bottom. (I really wanted a multiline UITextField, but that's not available according to How to create a multiline UITextfield?).

Below is the layout in Xcode.

enter image description here

When the program runs, the UITextView takes the entire view so the UIButton is not visible.

Hoe does one add a vertical spacer between the UITextView and the UIButton? The vertical and horizontal spacers (constraints?) are greyed out in Interface Builder when I select both the UITextView and the UIButton.

Community
  • 1
  • 1
jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    We need more information. Is your view in a UIViewController? What are the constraints on your views (you can find these in the Size inspector)? – Morgan Harris Sep 01 '13 at 02:08
  • Thanks Morgan. I uploaded an image with the view open in Xcode. – jww Sep 17 '13 at 01:04
  • Make sure you undestand the implications of AutoLayout when using it (hint: you may disable it). – Till Sep 17 '13 at 01:17

1 Answers1

1

From the very less info I can only say that you could do something like this

[[UITextView alloc] initWithFrame:CGRectMake(10, 10, width, height)];

width and height is depending on your device screen. You could also try

[[UITextView alloc] initWithFrame:self.view.bounds];

Another solution might be

If you select your UITextView in the IB and look at its outlets, you should see something like the below where it has a Referencing Outlet to the view controller's view property.

When the view controller is being loaded this relationship forces the text field to take up the whole screen. Deleting the referencing outlet should cause the screen to display correctly.

enter image description here

Akshay
  • 1,341
  • 2
  • 9
  • 18
  • Thanks aarn. I'm actually using Interface Builder, and not creating them dynamically in code (some handwaiving). – jww Sep 17 '13 at 00:58