Discussion Forums  >  Status Bar, Navigation Bar

Replies: 1    Views: 110

chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
11/16/12 02:03 PM (11 years ago)

need some help with coding

Okay, I've still got this issue with the back button (see https://www.buzztouch.com/forum/thread.php?tid=F1229BD8B13A204E3222DDF&fid=A2F08DF30D5B47C3F930107&sortColumn=FT.id&sortUpDown=DESC&currentPage=1) Susan is doing me a favor by working on a plugin that will show the bottom toolbar for Custom URL screens using custom images, so as to draw users' eyes down there. However, I'm wondering if there's not a way to still solve this by combining the top navbar back button for menu screens and the bottom toolbar back button for Custom URL screens. I found the relevant code for each: //BT_screen_customURL.m: //go back -(void)goBack{ [BT_debugger showIt:self:@"goBack"]; if([self.webView canGoBack]){ [self.webView goBack]; } } //BT_viewUtilities.m: /* add a back button, a refresh button Back buttons go on all screens that are not the "home" screen for non-child apps. Refresh button goes on the "home screen" BUT only if the app uses a dataURL */ //is this the home screen (it could be the home screen of any tab) if([theViewController.navigationController.viewControllers count] < 2 && ![appDelegate.rootApp isChildApp]){ if([appDelegate respondsToSelector:@selector(downloadAppData)]){ if([appDelegate.rootApp.dataURL length] > 3){ /* When do we show the left refresh button? BT_application flags the isHomeScreen property of the root controller of the app to allow for this. For tabbed apps, only the first tab will show the refresh button. */ if([theScreenData isHomeScreen]){ UIBarButtonItem *theRefreshButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:appDelegate action:@selector(downloadAppData)]; [theViewController.navigationItem setLeftBarButtonItem:theRefreshButtonItem]; [theRefreshButtonItem release]; } } } }else{ if([theViewController respondsToSelector:@selector(navLeftTap)]){ NSString *backText = NSLocalizedString(@"back",@"back"); if(![[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarBackButtonText":@""] isEqualToString:@""]){ backText = [BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarBackButtonText":@""]; } //navLeftTap or closeChildApp UIBarButtonItem *theBackButtonItem = theBackButtonItem = [[UIBarButtonItem alloc] initWithTitle:backText style:UIBarButtonItemStylePlain target:theViewController action:@selector(navLeftTap)]; [theViewController.navigationItem setLeftBarButtonItem:theBackButtonItem]; [theBackButtonItem release]; }else{ [theViewController.navigationItem setLeftBarButtonItem:nil]; } }
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/16/12 02:05 PM (11 years ago)
So, is it possible to rewrite the BT_viewUtilities.m code to incorporate a if/then check to see if the current screen has a webview, and if so, force the back button to call "self.webView goBack". If not, it would go through the normal code for BT_viewUtilities.m ?
 

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.