Reputation: 3079
I am working with a Navigation-based Application. It parses a feed and show data in a tableView. in my main tableView i want to insert a UIWebView in the end. is it possible to make that tableView little bit small and put a UIWebView after that? Thanx
Upvotes: 0
Views: 1120
Reputation: 122
Yes it's possible try to insert subview at index 0
UITableViewCell *cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"cell"] autorelease];
UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
NSString *html = @"some string";
[webview loadHTMLString:html baseURL:nil];
[webview setBackgroundColor:[UIColor clearColor]];
[webview setOpaque:NO];
[cell insertSubview:webview atIndex:0];
return cell;
Upvotes: 0
Reputation: 90117
the navigation based application template uses an UITableViewController. When you change this class into the more generic UIViewController and add your tableView and webview you can do it.
change
@interface RootViewController : UITableViewController {
}
@end
into
@interface RootViewController : UIViewController {
UITableView *tableView;
UIWebView *webView;
}
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) IBOutlet UIWebView *webView;
@end
then open the RootViewController.xib in interface builder.
Upvotes: 2
Reputation: 304
I don't think you can limit the height of the UITableView in order to append a UIWebView after it. But you can always place a UIWebView in front of the UITableView, in your view hierarchy, if this suites you-- but it will be visible in your screen at all times, i.e. not after scrolling down to the end of your table.
If you need to scroll down and then show the web view, maybe you can place it inside a table view cell (the last one, obviously).
Upvotes: -1