开发者

Navigate a WebView

开发者 https://www.devze.com 2022-12-12 12:44 出处:网络
With a webview is it possible to set up a simple \'Back\' button (either in a navigation bar or a top toolbar) that doesn\'t show the back button on the first URL of the WebView - and only appearing o

With a webview is it possible to set up a simple 'Back' button (either in a navigation bar or a top toolbar) that doesn't show the back button on the first URL of the WebView - and only appearing on a second URL to get back to the first?

Unless I'm getting getting this wrong, in a lot of hybrid native/web apps such as News apps, you often see news articles in a table (HTML page rather than a 'programmed in xcode' table) which hyperlink to article detail pages (开发者_运维百科again, HTML rather than natively coded) - what I can't figure, is how the detail page (2nd URL in webview) displays with a 'back button' but the table (1st URL in webview) doesn't have the button showing in these type of apps?

Currently, I have a webview as described, with a 'back' bar button item in a toolbar at the top of screen (outlet as 'cangoback' for WebView) but the button is visible when there's no page to 'go back' to -

What I've got simply is:

Webview - 1st URL, HTML table - 'back' button shows, but isn't active (of course)

Webview - 2nd URL, HTML detail page - 'back' button shows, and can go back.

How do you get it to only appear on 2nd URL, or be HIDDEN on 1st URL?

Regards Randy


You can play with the Navigation Bar's visibility. Implement this:

[self.navigationController setNavigationBarHidden:YES animated:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消