Ios 在自定义UITableViewCell中添加了webView。然后,一排排的人都在乱跑
我使用的是使用自动布局(约束)的自定义tableview单元格。在该tableview单元格中,我添加了UIWebView,当我滚动行时,它将被拖动。请帮助任何人Ios 在自定义UITableViewCell中添加了webView。然后,一排排的人都在乱跑,ios,objective-c,iphone,Ios,Objective C,Iphone,我使用的是使用自动布局(约束)的自定义tableview单元格。在该tableview单元格中,我添加了UIWebView,当我滚动行时,它将被拖动。请帮助任何人 static NSString *cellidentifier=@"Cell"; subcell=(CTEAuctionBidNowTVCell *)[tableView dequeueReusableCellWithIdentifier:cellidentifier]; if (subcell==nil) { sub
static NSString *cellidentifier=@"Cell";
subcell=(CTEAuctionBidNowTVCell *)[tableView dequeueReusableCellWithIdentifier:cellidentifier];
if (subcell==nil)
{
subcell =(CTEAuctionBidNowTVCell *) [[[NSBundle mainBundle] loadNibNamed:@"CTEAuctionBidNowTVCell" owner:self options:nil]objectAtIndex:0];
}
它会被击中,因为当您滚动tableview时,table view单元格中的webview也会加载web请求,因为滚动时请求太多。请在滚动时检查meemory压力,不管怎样,我给你一些解决方案
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomTabelWebViewCell *cell = (CustomTabelWebViewCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"];
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"CustomTabelWebViewCell" owner:self options:nil];
if(cell==nil)
{
cell = nib[0];
}
//Here you load the webview
.......
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 193;
}
然后获取tableViewCell webview行的高度,调用下面的webview委托方法
- (void) webViewDidFinishLoad:(UIWebView *)aWebView
{
CGRect frame = aWebView.frame;
frame.size.height = 1;
aWebView.frame = frame;
CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
frame.size = fittingSize;
aWebView.frame = frame;
self.cellSize = fittingSize.height;
[self.tableView beginUpdates];
[self.tableView endUpdates];
NSLog(@"Calling webViewDidFinishLoad. Cell size value: %lf", self.cellSize);
}
不。。。我只是在给cell添加一个webview。但不返回webviewnot working的任何url。。。。静态NSString*cellidentifier=@“Cell”;subcell=(CTEAuctionBidNowTVCell*)[tableView dequeueReusableCellWithIdentifier:cellidentifier];如果(subcell==nil){subcell=(CTEAuctionBidNowTVCell*)[[NSBundle mainBundle]loadNibNamed:@“CTEAuctionBidNowTVCell”所有者:自选项:nil]objectAtIndex:0];}请添加一些代码和更多说明您面临的问题是什么?Strukking表示我们不明白。请说明您卡在哪里?当我滚动行时,表视图单元格会抖动。。。。缓慢加载