views:

347

answers:

2

I want to build a tab-Browser and so far I've implemented everything (Bookmarks, settings...) except tabbed browsing.

What I know so far is that I should store my webView in an array or a dictionary and then retrieve it. but it doesn't seem to work.

this is what I've tried so far in various variations:

[mainDrowser.webView removeFromSuperview]; 
mainDrowser.webView = [mainDrowser.arrayForTest objectAtIndex:anIndex];
[self.view addSubview:webView];

the view does appear, but it doesn't have the content of the saved webView but the content of the one I just removed.

Does anyone have an suggestion on how to do this?

also something I tried:

-(IBAction) saveAsTab:(id)sender {
    [tabDictionary setValue:addressField.text forKey:[webView stringByEvaluatingJavaScriptFromString:@"document.title"]];
    NSLog(@"tabDictionary: %@", tabDictionary);
    [tabData setValue:webView forKey: addressField.text];
    NSLog(@"tabData: %@", tabData);

-(void) showWebViewFromDictionaryAtKey:(NSString *)urlForWebView {

[webView removeFromSuperview];
[self.view addSubview:(UIWebView *)[tabData valueForKey:urlForWebView]];

}

in another class:

DrowserAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    DrowserViewController *mainDrowser = [appDelegate drowserViewController];
    NSString *urlStringForWebView = [mainDrowser.tabDictionary valueForKey:cellTitle];

    [mainDrowser showWebViewFromDictionaryAtKey:urlStringForWebView];

this doesn't work too. same problem

I also tried to change the webView by not removing and adding it. Is it possible that if I store a webView in an array the content isn't stored but only the properties of the view?

does someone have an idea if it might work with a private framework? this app is just for fun and not for the AppStore

thanks in advance for any help!

A: 

nevermind. I made a stupid noobish mistake (I'm very new to developing, only 3 weeks of experience :D)

I have to create a new instance of UIWebView for each tab.

sorry for this mistake.

Yllier