swift - How to show UITableViewController as a UIPopover ViewController -


i need show pop on tableview controller.

i using following code presenting pop on

func showpopover() {

let secondstoryboard = uistoryboard(name: "second", bundle: nil)

viewobj =  secondstoryboard.instantiateviewcontrollerwithidentifier("viewcontroller") as! viewcontroller viewobj.modalpresentationstyle = uimodalpresentationstyle.popover viewobj.preferredcontentsize = cgsizemake(400,500)  let popoverpresentationcontroller = viewobj.popoverpresentationcontroller popoverpresentationcontroller?.delegate = self popoverpresentationcontroller?.sourceview = self.view //walletbutton popoverpresentationcontroller?.sourcerect = cgrectmake(0, button.frame.origin.y+100, 0, 0) presentviewcontroller(viewobj, animated: true, completion: nil) } 

//mark:- uipopoverpresentationcontrollerdelegate methods... starts

func adaptivepresentationstyleforpresentationcontroller(controller: uipresentationcontroller) -> uimodalpresentationstyle{         return uimodalpresentationstyle.none     } 

as uiviewcontroller tried load uitableviewcontroller not working. uipopover displayed not displayed tableview.

please suggest me thank in-advance

func showpopover() {      let tableviewcontroller = uitableviewcontroller()     tableviewcontroller.modalpresentationstyle = uimodalpresentationstyle.popover     tableviewcontroller.preferredcontentsize = cgsizemake(200, 250)     tableviewcontroller.tableview=fonttable      presentviewcontroller(tableviewcontroller, animated: true, completion: nil)      let popoverpresentationcontroller = tableviewcontroller.popoverpresentationcontroller     popoverpresentationcontroller?.sourceview = sender as! uibutton     popoverpresentationcontroller?.sourcerect = cgrectmake(0, 0, sender.frame.size.width, sender.frame.size.height)     popoverpresentationcontroller?.delegate=self     popoverpresentationcontroller?.permittedarrowdirections=uipopoverarrowdirection.up }  func prepareforpopoverpresentation(popoverpresentationcontroller: uipopoverpresentationcontroller) { }  func popoverpresentationcontrollerdiddismisspopover(popoverpresentationcontroller: uipopoverpresentationcontroller) { }  func popoverpresentationcontrollershoulddismisspopover(popoverpresentationcontroller: uipopoverpresentationcontroller) -> bool {     return true } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -