ios - How to add a floating button in UITableViewController which does not scroll when table is scrolled? -
currently there uitableviewcontoller
many sections , rows.
what best way add button floats on top of table view. button should not scroll when cells scrolled.
currently have following code , button still scrolls:
override func viewdidload() { super.viewdidload() self.view.addsubview(viewforfooter) }
the viewforfooter
separate view contains button needs floating. thank you. appreciated.
here option if don't want use uiview subviews...
override func viewdidload() { super.viewdidload() if let app = uiapplication.shared.delegate as? appdelegate, let window = app.window { print("adding view-with-button keywindow") window.addsubview(viewforfooter) viewforfooter.topanchor.constraint(equalto: window.topanchor, constant: 120).isactive = true viewforfooter.leftanchor.constraint(equalto: window.leftanchor, constant: 40).isactive = true } // other stuff... }
this add view subview of "keywindow" @ 40,120, , "hover" there while scroll table. assuming viewforfooter
instantiated , have necessary constraints set correctly.
Comments
Post a Comment