I try to fix the position of floating button in the screen but when I scroll the tableView, the button move with cell. Please, any solution let me know.
Asked
Active
Viewed 158 times
3
-
1My guess is that you're adding the button as a subview of the tableView. You should add the button to the tableView's parent view if possible. If you are using a UITableViewController, this may not be possible though - you'll have to use a UIViewController instead to house the tableview and the floating button. – Ken Toh Dec 06 '16 at 05:37
-
1Add the button to the view controller's view, not the tableview itself, then it wont move – Tj3n Dec 06 '16 at 05:37
-
1I am using UITableViewController. – Kushal Shrestha Dec 06 '16 at 05:43
-
You should use View Controller, add button and table over it. – Bista Dec 06 '16 at 05:49
-
delete your tableviewcontroller, create new uiviewcontroller and add UITableView as a subview – Quang Hà Dec 06 '16 at 05:49
-
@KushalShrestha Add button on view, Not on tableview – iDeveloper Dec 06 '16 at 06:18
-
`self.view.addSubview(yourButton)` – iDeveloper Dec 06 '16 at 06:19
-
@ iDeveloper , it won't work. maybe because of UITableViewController – Kushal Shrestha Dec 06 '16 at 06:50
1 Answers
0
I think you you have actually added the floating button in UITableViewCell Mistakenly. Please check It carefully in your ViewController object hierarchy.
Or, if you are using UITableViewController, you have To change it to UIViewController:
How to put buttons over UITableView which won't scroll with table in iOS
Community
- 1
- 1
Abu Ul Hassan
- 1,340
- 11
- 28