iPhone|UIWebView: tabbed browsing by using NSArray?
Question
I want to code a small tabbed browser just for the fun. However I'm not sure how the tabbed thing works.
So this might be a noobish question:
can I store a current webView in an array? using: [array addObject:webView];
and if yes how do I load it into the webView again? maybe using: webView = [array objetAtIndex:anIndex]; will it appear instantly?
and is it possible to store the webView in and NSDictionary as value? (would be much easier to retrieve)
Thanks in advance
Solution
You can store anything you want in an array (or dictionary). So assuming youll have n WebViews for n tabs, (this might take up a lot o f memory, i dont know never tried it), when user clicks on a tab, you can do something like
[activeWebView removeFromSuperView]
activeWebView=[webViewArray objectAtIndex:tabIndex];
//then add the active web view to the view controller
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow