Plan B Plan B - 6 months ago 154
iOS Question

How to put buttons over UITableView which won't scroll with table in iOS

I want to put buttons over

UITableView
which stays on same position of screen, won't scroll with
UITableView
. When I tried to
addSubview
buttons, they are displayed but scrolls with
UITableView
.

Reason to put buttons over
UITableView
is to let user operate some action on it. I'm not talking about having buttons in cell. They are floating buttons which never moves their position.

I'm using
UITableViewController
, and I don't want to use header or footer for this purpose. And also another some bar (
UIToolbar
for instance) is not an option for me.

Thanks in advance.

Answer

One solution to this is to extend UIViewController instead of UITableViewController. You will need to add your own table view and set everything up. Then you can add your button's to the view controller's view instead of the table view.