ios - Transition without loose data with Storyboard and Swift -
i'm developing new project in swift i've big (and dumb) problem.
i've 3 viewcontrollers:
1.- call webservices, take json , pass json second view
2.- parsing data , put data in view (tableview , ok). @ view go other view button (to view 3). don't need pass nothing.
3.- try go view 2 view empty because data posicioning @ tableview pass view 1.
i try lot of solutions:
navigationcontroller!.dismissviewcontrolleranimated(false, completion: nil) -> if link storyboard transition view 3 view 2, view 2 empty, if don't link in storyboard -> unexpectedly found nil while unwrapping optional value
if change "!" "?" nothing
the same every code have been test.
my code is:
view 1 view 2: (connected in visual part of storyboard (ib))
@ibaction func gorecibospendientes(sender: uibutton) { let controllervc = self.storyboard!.instantiateviewcontrollerwithidentifier("recibos") as! tablarecibostableviewcontroller controllervc.initwithjson(self.jsonreceived) self.presentviewcontroller(controllervc, animated: true, completion: nil) } view 2 view 3: (connected in visual part of storyboard (ib))
@ibaction func gototablaproveedoresdeservicios(sender: uibutton) { let controllervc = self.storyboard!.instantiateviewcontrollerwithidentifier("proveedoresdeservicios") as! tablaproveedoresdeservicios self.presentviewcontroller(controllervc, animated: true, completion: nil) } view 3 2: try every kinds of (every kinds know, not every kinds)
@ibaction func backpressed(sender: uibutton) { navigationcontroller!.dismissviewcontrolleranimated(false, completion: nil) navigationcontroller!.dismissviewcontrolleranimated(true, completion: nil) navigationcontroller!.poptorootviewcontrolleranimated(true) } thanks lot.
if using navigationcontroller try push view controller remains previous view in stack.
self.navigationcontroller.pushviewcontroller(controllervc, animated: true)
Comments
Post a Comment