multi-tab web browsers with UIWebView on iOS

2020-04-18 09:09发布

问题:

I'm creating a simple web browser. I want my users to add tabs and browse many web pages at the same time, like in Safari, Firefox or Chrome. I've done this and it works great but I don't know if there is a simpler way to do this.

When the user adds a new tab, my application creates a new UIWebView in the background that is related to the new tab and loads a new URL. When the user selects another tab, the UIWebView that is related with this tab appears and the other disappears. Just it..

回答1:

I would use a UIViewController with the tabs as a parent view controller. Each tab would be associated with a child UIViewController containing a UIWebView. When you click on a different tab or create a new one, you can just hide the current child UIViewController's view and show the new one.