我添加子视图UITableViewCell
即如何检查的UITableViewCell包含的UIView
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault` reuseIdentifier:cellIdentifier];
这里_cellBackgroundView
属于UIView
。
[cell.contentView addSubview:_cellbackground];
我想的isDescendantOfView
帮助,以检查其中是否包含_cellbackground
,但我得到警告。
if (![_cellbackground isDescendantOfView:[cell subviews]]) {
[cell.contentView addSubview:_cellbackground];
}
else{
[_cellbackground removeFromSuperview];
}
引用Check if a subview is in a view
请帮
你说你正在接受警告。警告说什么? – Niko