Three20 doesn't show website in UIWebView

Hi everyone, I have a tab based application. In one view, I have TTTabStrip with different TTTabItems. Everything works (loading regular UIViewControllers), except loading UIWebViews.

In the application delegate, I configured the display URL:

TTNavigator* navigator = [TTNavigator navigator]; navigator.supportsShakeToReload = YES; navigator.persistenceMode = TTNavigatorPersistenceModeAll; TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; // default klasse wenn nichts anderes gewรคhlt ist. [map from:@"tt://test" toViewController:[TestController class]]; 

The control controller contains one UIWebView. I see (NSLog) that loadView-Method is being called, but the URL does not open:

 - (void) loadView { CGRect applicationFrame = [UIScreen mainScreen].applicationFrame; self.view = [[[UIView alloc] initWithFrame:applicationFrame] autorelease]; //self.view.backgroundColor = [UIColor blackColor]; NSURL *theURL = [NSURL URLWithString:@"http://www.google.com"]; [webView loadRequest:[NSURLRequest requestWithURL:theURL]]; // support zooming webView.scalesPageToFit = YES; } 

For example, I can change the background of the UIWebView to black.

How to load Google into web view under TTTabStrip?

Thank you very much.

+4
source share
1 answer

Try the following and add the viewWillAppear method:

 - (void)loadView { CGRect applicationFrame = [UIScreen mainScreen].applicationFrame; UIView * newView = [[UIView alloc] initWithFrame:applicationFrame]; // support zooming webView.scalesPageToFit = YES; [newView addSubview:webView]; self.view = newView; [newView release]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSURL *theURL = [NSURL URLWithString:@"http://www.google.com"]; [webView loadRequest:[NSURLRequest requestWithURL:theURL]]; } 
+3
source

Source: https://habr.com/ru/post/1344795/


All Articles