ios - remove view controller from navigation controller -
i have 5 view controllers in navigation controller, , want remove pages 3 , 4 on page five.the problem below code is, if remove index 3 , index 4 , on page five.i no button on top anymore.i should getting button page 2 again.but no. solution? thank provided.appreciated. error driving me crazy
navigationcontroller!.viewcontrollers.remove( at: 3 ) navigationcontroller!.viewcontrollers.remove( at: 4 )
i think cleaner way modify array of viewcontrollers , set them on navigation controller this..
if let nav = self.navigationcontroller {     var stack = nav.viewcontrollers     // index starts @ 0 page 3 index 2     stack.removeatindex(2)     stack.removeatindex(3)     nav.setviewcontrollers(stack, animated: true) }   i tested on 1 of navigation stacks , button retained, assume due setviewcontrollers method doing it's thing , setting stack you.
Comments
Post a Comment