ios - Attempt to present whose view is not in the window hierarchy when a cell is tapped -


i'm working on app uitableviewcontroller. idea when cell tapped on, info page pop showing information it. when tapped on, attempt present viewcontroller in class. however, warning shows , i'm not sure why.

i've tried looking @ questions similar mine on stackoverflow , other websites, don't make sense me. can explain problem behind warning , how fix it?

some of code:

override func tableview(_ tableview: uitableview,                          didselectrowat indexpath: indexpath) {     print("showing item info")     let cell = tableview.cellforrow(at: indexpath)     currentinfo = (cell?.textlabel?.text)!     currentdes = descriptions[indexpath.row]     currentbool = itembools[indexpath.row]     currentindexpath = indexpath     showinfo() }   func showinfo() {     let storyboard = uistoryboard(name: "main", bundle: nil)     let vc = storyboard.instantiateviewcontroller(withidentifier: "showinfoviewcontroller") as! showinfoviewcontroller     self.present(vc, animated: true, completion: nil) } 

warning message is:

attempt present <things_to_do.showinfoviewcontroller: 0x100b2fe20> on <things_to_do.tableviewcontroller: 0x100b05eb0> view not in window hierarchy! 

try add presentation style

swift 2

vc.modalpresentationstyle = .formsheet vc.modaltransitionstyle = .coververtical 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -