ios - How do I prevent table view scrolling behind a view? -


in tableviewcontroller, have translucent overlay view message. overlay displayed on tableviewcontroller correctly can still scroll table view behind overlay view. how can prevent scrolling when overlay on top?

i constructed custom overlay view in tableviewcontroller:

override func viewdidload() {     super.viewdidload()      loaddata(         id,         success: {(doc) -> () in             let frame = cgrect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)              let overlayview = emptycollectionview(frame : frame)             overlayview.backgroundcolor = uicolor(red: 0, green: 0, blue: 0, alpha: 0.8)             self.view.addsubview(overlayview)              self.tableview.reloaddata()         },         error: {..}) } 

i tried self.tableview.isuserinteractionenabled = false

ok - if in uitableviewcontroller, self.view refers uitableview itself. want add overlayview subview of table view's superview...

try this:

tableview.superview?.addsubview(overlayview) 

you can simplify few things well, , should implement sizing control handle changes such device rotation:

let overlayview = emptycollectionview(frame: tableview.frame)  overlayview.autoresizingmask = [.flexiblewidth, .flexibleheight]  overlayview.backgroundcolor = uicolor(red: 0, green: 0, blue: 0, alpha: 0.8)  tableview.superview?.addsubview(overlayview) 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -