-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.heightDic = [[NSMutableDictionary alloc]init];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(notifi:) name:@"TestHeight" object:nil];
}
-(void)notifi:(NSNotification *)nofi
{
TestCell * cell = nofi.userInfo[@"DataView"];
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];
if (![self.heightDic objectForKey:[NSString stringWithFormat:@"%ld",(long)indexPath.section]]) {
[self.heightDic setObject:nofi.userInfo[@"DataHeight"] forKey:[NSString stringWithFormat:@"%ld",(long)indexPath.section]];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableV

本文介绍了如何在iOS应用中,为UITableView的自定义cell内嵌入WebView并实现内容自适应高度。通过监听WebView加载完成的通知,动态更新cell高度,确保内容完整显示。同时,对网页样式进行了设置,以适应不同设备的屏幕尺寸。
最低0.47元/天 解锁文章
5288

被折叠的 条评论
为什么被折叠?



