Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 6    Views: 312

Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
03/19/14 07:57 AM (10 years ago)

How to send user back up the navigation tree?

I have a scenario in which after the User taps a button, it goes to my custom plugin. The plugin cleans out some user-generated data. Then it shows an 'all done cleaning' message on the screen. How do I send the User back up the navigation stack to a screen that is two levels earlier? Here is the tap sequence: 0. Button Menu with two buttons on it: 'XYZ' button and 'Wipe Data' button 1. User taps on the 'Wipe Data' button, which takes them to next screen 2. User then taps on the 'Confirm Wipe' button (another button menu) 3. Then the User is sent to my Custom Plugin 4. The Custom plugin then clears the data 5. That Custom plugin displays a UITextView saying 'data has been wiped'. 6. User has to hit Back button several times to return to #0 Menu Instead, how do I make step #6 automatically take the User back to the screen in Step #0 ? It should pop off the appropriate items from the Navigation stack. -- Niraj
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
03/19/14 08:00 AM (10 years ago)
I am willing to switch Step #2 over to an Alert plugin. (Admittedly, that is the correct UI element to use for confirmations)
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
03/19/14 09:59 AM (10 years ago)
Could you use the right button type & load screen approach that is used on some plugins?
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/19/14 03:46 PM (10 years ago)
Niraj would this help? http://www.buzztouch.com/forum/thread.php?tid=859C313A2DB66DD6182A63C&sortColumn=FT.id&sortUpDown=DESC&currentPage=1 See Chris's code in there, you could customise whatever button you want in the nav bar of your custom plugin to call an action that loads the screen you want. Cheers Paddy
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
03/19/14 08:19 PM (10 years ago)
Hey there Alan and Paddy, thanks for the suggestion. That tip is not applicable because it does not "pop off the screens" from the stack. Each time a Back button is displayed in the upper-left, that means the previous (parent) screen was put onto a stack (of screens). For my case, I need to pull two screens off the top of the stack in order to display the 3rd item in the stack.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
03/20/14 07:45 AM (10 years ago)
This is about the closet I've gotten to achieving something like that. This should take all views off the stack and take you back, but that depends on what your rvc is: Add this method to the plugin- - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.navigationController popToRootViewControllerAnimated:YES]; } I've also on occasion added a button to the navbar and manually pushed the view controller I know I want to go to - Push a VC without a XIB file: NirajViewController *myController = [[NirajViewController alloc] init]; [self.navigationController presentViewController:myController animated:YES completion:nil]; Push a VC with an XIB file: NirajViewController *controller = [[NirajViewController alloc] initWithNibName:@"NirajViewController" bundle:nil]; [self.navigationController pushViewController:controller animated:YES]; Regrdless, the BT Nav being a subclass of UINavigation makes this tricky to reasearch outside of BT. It's the downside of proprietary code like this. I hope there is a good BT solution for this since I'm trying to accomplish something very similar with a plugin and it's stopping my progress. I'm running into an issue of a view being pushed twice and when I try to go 'back' It's sticking on the screen and crashing my app with a 'can't add self as subview' error. This seems to be a new problem with iOS7 and definately with the new BT 3.0 core. I say that because my same code works in a BT 2.0 project but not the new 3.0 core - both built and compiled under iOS 7.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
03/20/14 08:44 AM (10 years ago)
Thanks Tim for the tips! Chris1 gave me the same tip on the Developer Webinar yesterday. Bummer -- it does not work. Using this one results in errors: - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.navigationController popToRootViewControllerAnimated:YES]; } Error 1: nested pop animation can result in corrupted navigation bar Error 2: Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. I will have to try on a blank screen plugin to make sure it is all innocent tomfoolery. -- Niraj
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.