Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 1    Views: 46

Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
05/02/13 08:25 PM (12 years ago)

Automatically Load Previous Screen

Hi All, Is it possible to have a plugin automatically load the previous screen? Example: -On Screen 1, user taps Screen 2 -On Screen 2, Screen 3 automatically loads -On Screen 3, user taps back and screen 1 loads? (By going back to screen 2 and just loading the previous screen, screen 1) Jake
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/02/13 09:55 PM (12 years ago)
Haven't actually tested this, but I believe it should work. Assuming this is iOS: Screen 2: -(void)viewDidLoad{ [super viewDidLoad]; //create a BT_item representing screen 3 BT_item *tmpItemToLoad = [[BT_item alloc]init]; tmpItemToLoad.itemId = @"screen3Id"; tmpItemToLoad.itemNickname = @"screen3Nickname"; tmpItemToLoad.itemType = @"classOrPluginNameForScreen3"; //load JSON for screen 3 NSMutableDictionary *tmpJSON = [[NSMutable Dictionary alloc]init]; [tmpJson setObject:@"screen3Id" forKey:@"itemId"]; [tmpJson setObject:@"screen3Nickname" forKey:@"itemNickname"]; [tmpJson setObject:@"classOrPluginNameForScreen3" forKey:@"itemType"]; [tmpJson setObject:@"someValueHere" forKey:@"someJSONkey"]; tmpItemToLoad.jsonVars = tmpJson; //load screen 3 [BT_viewControllerManager handleTapToLoadScreen:[self screenData] theMenuItemData:nil theScreenData:tmpItemToLoad]; } ----------------------- Screen 3: -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear]; //set up 'back' button UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(userPressedBack)]; [self.navigationItem setLeftBarButtonItem:newBackButton]; } -(void)userPressedBack { [self.navigationController popViewControllerAnimated:NO]; [self.navigationController popViewControllerAnimated:YES]; }
 

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.