內容我已經給網頁視圖在分區域的UITableViewCell這樣UIWebView的大小不是設置在網頁視圖
if(section==0)
{
static NSString *[email protected]"Cell";
UITableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
webView = [[UIWebView alloc] initWithFrame:CGRectZero];
webView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
webView.tag = 1001;
webView.userInteractionEnabled = NO;
webView.backgroundColor = [UIColor clearColor];
webView.opaque = NO;
[cell addSubview:webView];
}
webView = (UIWebView*)[cell viewWithTag:1001];
webView.delegate=self;
webView.frame=CGRectMake(0, 0, 300, 1000);
NSLog(@"current mode: %@", [[NSRunLoop currentRunLoop] currentMode]);
[webView loadHTMLString: [NSString stringWithFormat:[arrSecCount objectAtIndex:0], indexPath.section]baseURL:nil];
return cell;
}
where as the content in webview is dynamic.in
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section==0)
{
NSString *output = [webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"];
return [output floatValue]+300;
}
}
但是當視圖內容增加了它在其它部分沒有裝修overiding height.i已經嘗試了很多方法搜索但沒用。 幫我看看你的建議
當您嘗試這樣做時發生了什麼? – Balu
wats錯了嗎? – user2197875
你在輸出對象中得到了正確的值嗎? – Balu