Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 73

Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
06/29/15 07:41 AM (9 years ago)

Open link CUSTOM URL

Hi, I would like to know, if it were possible to open a link in a new webview. Currently, when I click in a link in a CUSTOM URL, the page opens in the same webview. I would like to have a back button (in the top bar) so I can go back page by page. Thx
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
06/29/15 09:16 AM (9 years ago)
To back in a custom url screen, I recall @chris1 posted a good mod that allows the back button on the navbar to go back in webview history on iOS, not just jump to the previous screen altogether. It works on custom URL and maybe more. I lost the original link for his post, but I copied the content of his post a while back. Step 1) In the -(void)viewWillAppear method, add this code: UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(navLeftTap)]; self.navigationItem.leftBarButtonItem = backButton; Step 2) Outside the curly braces (right after the viewWillAppear method finishes is fine), add this code: -(void)navLeftTap { [BT_debugger showIt:self message:@"navLeftTap"]; if([self.webView canGoBack]){ [self.webView goBack]; } else [super navLeftTap]; } I take no credit for coming up with this, it's all @chris1, but I can vouch that it works for me.
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
06/29/15 09:24 AM (9 years ago)
Nice tip, Alan! :-) That Chris feller sure has a lot of diamonds in his bag! -- Niraj
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
06/30/15 07:51 AM (9 years ago)
great this is exactly what I wanted thx ;)
 

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.