user2786
user2786

Reputation: 716

URL is not loading completely on my UIWebView in iOS?

I am working on an iPhone application, where i am opening an URL to my UIWebView. The problem is URL is not loading perfectly. As per my requirement, i need to add UIWebView as footer view of my table. but the problem is after getting the web view content height size from webViewDidFinishLoad method, i am setting frame of my footer view. here is my code :

- (void)webViewDidFinishLoad:(UIWebView *)aWebView {

        aWebView.scrollView.scrollEnabled = NO;
        CGRect frame = aWebView.frame;
        frame.size.height = 1;
        aWebView.frame = frame;
        CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
        frame.size = fittingSize;
        aWebView.frame = frame;

        [self setFooterView:fittingSize.height + aWebView.frame.origin.y];
}

-(void)setFooterView:(float)fittingHeight
{
    bottomView.frame = CGRectMake(0, 0, 320, fittingHeight);
    webViewSocial.frame = bottomView.frame;
    [tableView reloadData];
}

But when i am scrolling my table view, then my UIWebView (footer view) is not scrolling completely. Can you please tell me how can i achieve my output. Thanks!

Upvotes: 1

Views: 491

Answers (1)

l0gg3r
l0gg3r

Reputation: 8954

try to set like this

- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
       CGFloat height = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.height"] floatValue];
       CGFloat width = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.width"] floatValue];
       CGRect frame = self.webView.frame;
       frame.size.height = height;
       frame.size.width = width;
       self.webView.frame = frame;
       self.tableView.tableFooterView = webView;
}

Upvotes: 1

Related Questions