cocoa:how to use a web view property created in a class derived from NSViewController in an app delegate class? -
the code in app delegate class:
- (void)webview:(webview *)webview decidepolicyfornewwindowaction:(nsdictionary *)actioninformation request:(nsurlrequest *)request newframename:(nsstring *)framename decisionlistener:(id < webpolicydecisionlistener >)listener{ nslog(@"hello"); nstabviewitem *newitem=[[nstabviewitem alloc] init]; nsinteger index = [_tabview numberoftabviewitems]; [_tabview inserttabviewitem:newitem atindex:index]; [newitem setlabel:@"empty tab" ]; //[_tabview selectprevioustabviewitem:@"select"]; newvc =[[newviewcontroller alloc] initwithnibname:@"newviewcontroller" bundle:nil]; [[_tabview .tabviewitems objectatindex:index] setview:[newvc view]]; newviewcontroller *obj=[newviewcontroller alloc]init]; [obj.newwebview mainframe]loadrequest:request];
}
this code not loading web view requested url. here newwebview web view property have created in newviewcontroller class.
first of all, trying do?
newviewcontroller *obj=[[newviewcontroller alloc]init];
is allocating brand new object you're never sticking user interface. hence, obj.newwebview
never show either.
i'm not sure, think you're looking
[[newvc.newwebview mainframe]loadrequest:request];
instead? there's couple missing brackets in code, assume they're typos!
Comments
Post a Comment