How to set content tab in UITableView after returning from a separate stream?
Here is some code to get the gist of what I'm doing, feel free to offer suggestions outside the scope of this question.
My main goal is to collapse the area that the webview will go into (the area above the table created using the contentInset) if there is no advertisement.
[NSThread detachNewThreadSelector:@selector(getBannerAdContent) toTarget:self withObject:nil];
-(void)getBannerAdContent
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *html = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://192.168.0.18:83/PhotoGalleryService.svc/LoadBannerAd/"]];
[self performSelectorOnMainThread:@selector(loadBannerAd:) withObject:html waitUntilDone:NO];
[pool release];
}
-(void)loadBannerAd:(NSString*)html
{
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 2, 300, 40)];
[webView loadHTMLString:html baseURL:nil];
webView.delegate = self;
webView.scalesPageToFit = NO;
webView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
[self.view addSubview:webView];
[webView release];
UITableView *myTableView = (UITableView*)[self.view.subviews objectAtIndex:0 ];
myTableView.contentInset = UIEdgeInsetsMake(44,0.0,0,0.0);
}
Any help you can give me would be greatly appreciated.
EDIT: A bit more detailed explanation ...
In my opinion, I booted up, a spark separate stream. This thread downloads html from the i service configured, and then installs it in webview. However, as I step over before he gets on the line
myTableView.contentInset = UIEdgeInsetsMake(44,0.0,0,0.0);
, .
,