user317033
user317033

Reputation:

Showing UIWebView over tableView in UITableViewController

I added a rightBarButton and I'd like to have that button hide the TableView and show my UIWebView, but I am not seeing the web view.

UITableViewController

viewDidLoad:

    mWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 380)];
    [mWebView loadHTMLString:@"<html><body>Testing</body></html>" baseURL:nil];
    mWebView.hidden=YES;
    [self.view addSubview:mWebView];

onButton:

    mWebView.hidden = NO;
    self.tableView.hidden=YES;

The tableView disappears, but all I get is a white screen instead of the expected 'Testing'

Upvotes: 0

Views: 349

Answers (2)

user745098
user745098

Reputation:

Try [webview setBackGroundColor: [UIColor clearColor]];

and [webview setOpaque: NO];

Upvotes: 0

Richard Brightwell
Richard Brightwell

Reputation: 3012

You may need to add [mWebView setNeedsDisplay] and possibly [self.tableView setNeedsDisplay].

Upvotes: 1

Related Questions