ios - Toggle between UIviews in Xcode -
i newbie in xcode , still learning basics. if question feels basic, please bear me.
i have view, main view. when user clicks on button (options button), want go second view. here user can select 1 option many available.
once user selected option, want send value first view , resume processing (when user clicked options button).
important - user moving view1 view2 in mid of processing. have join view2 view1 , resume left off... means, need variable values available.
a push segue won't create new version of parent view controller. starting session processing in viewdidload or in viewdidappear / viewwillappear? stopping processing in viewwilldisappear? in viewwilldisappear, can check navigation controller's stack see if parent view has been covered or being popped stack using code snippet:
- (void)viewwilldisappear:(bool)animated { if ([[[self navigationcontroller] viewcontrollers] indexofobject:self] == nsnotfound) { // disappearing. clean session. ... } [super viewwilldisappear:animated]; }
you can store (limited amounts of) state in view controller, using uiviewcontroller's encoderestorablestatewithcoder: method - check documentation. don't use myself help.
by way, may find easier use uiviewcontroller's done:, reset: , canperformunwindsegueaction:fromviewcontroller:withsender: rather create delegate protocols. unwind segues introduced in ios 6 , require less code delegates.
Comments
Post a Comment