Is there a way for a cell, if used in a grouped table vie开发者_如何学Gow, detect that fact and modify its appearance as ro not overlap the rounded rect borders?
There are two ways to do this. If you are making a custom cell you can just add a boolean property to the cell and set it when you create the cell. Or, you can do this:
UITableView *parentTable = (UITableView *)self.superview;
if (parentTable.style == UITableViewstyleGrouped {
//Do what you need to do for a grouped cell
}
else {
//Do what you need to do for a plain cell
}
In a grouped table view, such a cell will always be the 1st or last of the section. You can easily identify it in cellForRowAtIndexPath:
, by looking at the indexPath
parameter.
精彩评论