开发者

How to display buttons under a TableView at the bottom of a screen?

开发者 https://www.devze.com 2023-02-27 14:41 出处:网络
I am trying to build a screen like this: I\'ve already built the navigationItem (the \"title Bar\") and the table view, now I\'m looking for a way to add the buttons under the table view.

I am trying to build a screen like this:

How to display buttons under a TableView at the bottom of a screen?

I've already built the navigationItem (the "title Bar") and the table view, now I'm looking for a way to add the buttons under the table view.

The result should look similar to a tab bar, but as the开发者_运维问答 buttons are used to influence the the number of displayed records in the table, I'm only dealing with one controller.

How do I achieve what I'm looking for?


I can think of two ways off the top of my head you could accomplish something like this.

  1. You could create a UISegmentedControl and place it in your tableview's tableFooterView property. The buttons would only be visible underneath the tableview and would scroll with the table.
  2. You could create a UIToolbar, or ideally display the toolbar you get for free with the navigation controller, and place a UISegmentedControl there. This way the buttons would always be visible regardless of where the user has scrolled to.

Hope this gets you started.


A couple of approaches suggest themselves:

1) You could use an actual tab bar. If you do that, your outermost view controller has to be the UITabBarController. Some searching on "UITableView inside UITabBar" and the like should give you more details.

2) Set the frame of the UITableView to be less than the whole screen. Have both it and the buttons (which might well be a UISegmentedControl) be subviews of a common container.

0

精彩评论

暂无评论...
验证码 换一张
取 消