I am adding subview to UITableViewCell
i.e
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault` reuseIdentifier:cellIdentifier];
Here _cellBackgroundView
belongs to UIView
.
[cell.contentView addSubview:_cellbackground];
I want to check by the help of isDescendantOfView
if it contains _cellbackground
, but I am getting warning.
if (![_cellbackground isDescendantOfView:[cell subviews]]) {
[cell.contentView addSubview:_cellbackground];
}
else{
[_cellbackground removeFromSuperview];
}
references Check if a subview is in a view
Please help