ios - How to return from IBAction into root Split View Controller into Master View Controller -
i having issue returning root split view controller. have login page button on separate view controller , want user return split view controller after login. code have returns user root split view controller, takes him empty detail view controller. change need implement user taken master view controller data?
@ibaction func gohome(sender: anyobject) { let storyboard = uistoryboard(name: "main", bundle: nil) let splitviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("splitviewcontrollerid") as! uisplitviewcontroller let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate appdelegate.window?.rootviewcontroller = splitviewcontroller }
you need implement method uisplitviewcontrollerdelegate protocol:
func splitviewcontroller(_ splitviewcontroller: uisplitviewcontroller, collapsesecondary secondaryviewcontroller: uiviewcontroller, onto primaryviewcontroller: uiviewcontroller) -> bool { return true }
when method returns true, master view controller shown default.
Comments
Post a Comment