Take the 2-minute tour ×

I am trying to create a UIWebView in UITableView footer. The table is grouped. Actually I am trying to create a hyperlink using UIWebView. For example there should be some text like

Hey folks Contact me

Contact me should be a hyperlink and I want to place this text in UITableView footer. I am unable to figure out how to do it..please guide me guys..if possible please post some sample code or please give me a link for the tutorial..I didn't use IB here to create the webview..I just declared webview in .h file

This is the code I wrote in viewForFooterInSection method

CGRect webFrame = CGRectMake(20,500,buttonView.frame.size.width,buttonView.frame.size.height);  
        webView = [[UIWebView alloc] initWithFrame:webFrame];  
        webView.backgroundColor = [UIColor lightGrayColor];  
        [self.view addSubview:webView];  
        NSString *html = @"<html><head></head><body>Hey Folks Contact Us</br></body></html>";  
        [webView loadHTMLString:html baseURL:[NSURL URLWithString:@"http://www.example.com"]];
share|improve this question
Do you want to put it as a view in section or in table? If in table, you should use viewForFooterInTable. –  Nava Carmon Sep 2 '10 at 15:25
Yup I want to use it as a view in table..even if there are no sections present the webview with hyperlink should be displayed –  racharambola Sep 2 '10 at 15:34
add comment

2 Answers

up vote 0 down vote accepted

Hopefully relevant: UIButton in UITableView Footer

They are creating a button at the UITableView footer with a UIView so maybe you can implement the same using your UIWebView instead of the UIButton.

share|improve this answer
thanks for the reply Kennzo..I created buttons for another purpose and its working fine..I am unable to use UIWebView as I think I am doing some mistake in the above code.. –  racharambola Sep 2 '10 at 15:19
add comment

For adding a custom footer to a table you have a property - tableFooterView. you need to assign the webView you're creating to this property.

In your table view controller's viewDidLoad method do the following:

if (self.tableView.tableFooterView == nil) {
            // Create your webView (move here your code)
    self.tableView.tableFooterView = yourWebView;

This works for me, I create my view from nib file.

share|improve this answer
add comment

Your Answer


