Noor
Noor

Reputation: 20150

Cannot add Toolbar end of screen

I'm trying to add a Toolbar in interface builder in the following View:

enter image description here

However, when adding the toolbar, it is not going at the bottom of the screen but is like this: enter image description here

As a result, at runtime, the toolbar is appearing like a row in the table.

Any suggestion why the toolbar is not going at the end of the screen and how can I solve this?

Upvotes: 0

Views: 91

Answers (3)

aakil nikil
aakil nikil

Reputation: 277

  1. Drag a UIViewController into Storyboard
  2. Drag a UIToolbar and place it bottom of the ViewController
  3. Drag a UITableView on top of the ViewController

Declare delegate and data source like this.

   @interface YourViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>

Hope this will help you.

Upvotes: 0

Suryakant Sharma
Suryakant Sharma

Reputation: 3960

In tableView you can have only cells, that's why toolbar getting add as cell instead a toolbar in bottom. So for adding toolbar at that controller, you can decrease the size of tableView by 44 (size of a toolbar) and than in Controller's View you can add your toolBar . I added a ScreenShot enter image description here

Upvotes: 0

Atul
Atul

Reputation: 698

It seems you are adding toolbar inside table view,

  1. If you want to add it at bottom, please add it outside tableView.
  2. If you want it inside table view you can use viewForFooter delegate.

Upvotes: 1

Related Questions