I have a UIWebView on the bottom of a UITableView:
[self.tableView setTableFooterView:webview];
I need to add some buttons at the end of the UIWebView. The height of the UIWebView isn’t constant. If I do something like
[webview addSubview:button];
The button will overlap the webview, since the coordinates of the button’s frame are based on the beginning of the UIWebView.
I thought about defining the button’s frame after finishing load the UIWebView:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGRect frame = CGRectMake(10, webView.bounds.size.height, 280, 21);
But the problem is that I also have some data in the UITableView and it’s height isn’t constant. Of course I could keep the height of the UITableView in a variable while I’m building it, but I think that’s a very ugly solution.
I also thought about having 2 footers in the UITableView, but it doesn’t look like it is possible…
Just in case it is relevant, the UIWebView loads a HTML string before the buttons are added.
Any ideas?
Thanks.
You say you thought of having two footer views. Obviously
UITableViewdoesn’t support that. But what you can do is create a customUIViewto contain theUIWebViewand the buttons, e.g.:And then set that as the tableview’s footer view.