开发者

Can a UITableViewCell know that it should be in grouped mode?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜