how dismiss view controller call using method
func openupgradeaccount(){ let appdel = appdelegate.sharedinstance() let storyboard = uistoryboard(name: "main", bundle: nil) let earnfreespace = storyboard.instantiateviewcontrollerwithidentifier("iapupgradevc") as! iapupgradevc let navigation:uinavigationcontroller = uinavigationcontroller(rootviewcontroller: earnfreespace) appdel.drawercontroller!.mainviewcontroller = navigation appdel.drawercontroller!.setdrawerstate(.closed, animated: true) }
in controller add uibarbuttonitem cancel id viewdidload method
let cancelbarbtn = uibarbuttonitem(title: nslocalizedstring("cancel", tablename: applocalizedtable, comment: ""), style: uibarbuttonitemstyle.done, target: self, action: #selector(iapupgradevc.didtapcancelbutton(_:))) cancelbarbtn.tintcolor = uicolor.whitecolor() self.navigationitem.leftbarbuttonitem = cancelbarbtn
the didtapcancelbutton method use dismiss view
func didtapcancelbutton(sender: uibarbuttonitem) { self.dismissviewcontrolleranimated(true) { () -> void in }
but when tap cancel button nothing happen , want how can return last viewcontroller , can me ?
first of all, drawercontroller? what's superclass , what's mainviewcontroller supposed be?
the method call when tapping button dismissing view controller presented modally. before that, not present view controller modally, setting drawercontroller's mainviewcontroller instead:
appdel.drawercontroller!.mainviewcontroller = navigation
one way make work change line, instead of setting mainviewcontroller call presentviewcontroller present new view controller modally.
if not how want work (no presentation of view controllers), you'd have elaborate on want both new vc , drawercontroller do.
Comments
Post a Comment