UITableViewCell.m文件直接添加此方法
- (void)addSubview:(UIView *)view
{
if (![view isKindOfClass:[NSClassFromString(@"_UITableViewCellSeparatorView") class]] && view)
[super addSubview:view];
}
本文介绍了一种在UITableViewCell中自定义添加子视图的方法,通过重写addSubview方法实现,排除了UITableViewCellSeparatorView的默认行为,适用于iOS开发中自定义单元格布局的需求。
UITableViewCell.m文件直接添加此方法
- (void)addSubview:(UIView *)view
{
if (![view isKindOfClass:[NSClassFromString(@"_UITableViewCellSeparatorView") class]] && view)
[super addSubview:view];
}