1

I apologize in advance for the unusual stack question here, but I'm having some terrible difficulty(refer the image below)

Issue

I'm trying to set a UIToolbar or UIView or maybe even a UITableViewCell at the bottom of this view where I can set my create button but when I attempt to do so, they all align to the top to fit underneath the cell above (the one containing the UITextView).

Aside from this, I need the UIButton (no matter what it lies in) to remain at the bottom of the view, regardless of screen size.
In other words, the "create" button needs to stay at the bottom of the view for 3.5-inch retina and 4-inch retina.

Currently I have placed down a UIView, expanded it to the bottom of the UITableViewController, layer a toolbar at the bottom of the view and then placed the UIButton in the toolbar.

What am I doing wrong?

staticVoidMan
  • 19,275
  • 6
  • 69
  • 98
Chisx
  • 1,976
  • 4
  • 25
  • 53
  • can you add a screenshot of how it looks on your device running? – Refael.S Jan 05 '14 at 08:54
  • so why don't you simply resize the `UITableView` frame to be 30px shorter than `self.view`? Then take a `UIButton` (_height of 30px_) and pin it to the bottom of the screen (_again... `self.view` **not** `tableView.view`_). Right now, it seems that you are trying to put this in the `tableView`'s view so technically, it will scroll with the rest of the `tableView` (which is not what you want... right?) – staticVoidMan Jan 05 '14 at 09:04
  • That's a much simpler idea, and I'm trying that right now, the problem is that I have a table view inside a tableviewcontroller, and I can't seem to even edit the table view(can't change the size) – Chisx Jan 06 '14 at 02:40

1 Answers1

3

Instead of using a container view such as UIToolbar or UIView, you can do this with just a UIButton. However, if you are intending to add more than one buttons, then UIToolbar is probably gonna be a better choice.

Anyways, to pin a control to the bottom of your screen regardless of size, you need to set its vertical spacing to the Bottom Layout Guide in your storyboard.

Please make sure your UIButton is on the top of UITableView not below. To ensure that, make sure UIButton is listed below UITableView in the Interface Builder's document tree.

Here is a screenshot of how your UIButton constraints and position in the document tree may look like!

enter image description here

enter image description here

Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
  • This is an awesome answer @Yas Kuraishi, right now I'm trying to follow all of your steps. Ill vote as answer once I've got it worked out. – Chisx Jan 05 '14 at 22:17
  • Honestly I can't figure out how to add constraints in Xcode 5 – Chisx Jan 06 '14 at 03:09
  • This post should show you how to pin a view's left, right, top, and bottom to its parent. You only need to pin, your button's left and right and check height checkbox, then control+drag your button to bottom layout guide, and then select vertical from the popup. http://stackoverflow.com/questions/20502860/scroll-view-not-functioning-ios-7/20503513#20503513 – Yas Tabasam Jan 06 '14 at 03:48
  • I actually just learned that I'm having problems setting constraints because I'm using a UITableViewController, but thanks for all your input on this man, I'm gunna use it while setting up the new VC @Yas Kuraishi – Chisx Jan 06 '14 at 04:02