开发者

How to Prevent Shadow at the top of grouped UITableViewCell from appearing & disappearing when selected

开发者 https://www.devze.com 2023-02-10 02:36 出处:网络
I want to disallow selection of certain UITableViewCells in a grouped table. Using selectionStyle = UITableViewSelectionStyleNone works and so does willSelectRowAtIndexPath.

I want to disallow selection of certain UITableViewCells in a grouped table. Using selectionStyle = UITableViewSelectionStyleNone works and so does willSelectRowAtIndexPath.

The issue is at开发者_开发百科 the top of each of the groups of cells there is a shadow that disappears when a finger touches down on the top cell and reappears when it lifts off. How do I turn it off?

Thanks =)


That shadow is from the UITableView "Separator" dropdown in Interface Builder: "Single Line Etched". The best way to handle it is subclass UITableViewCell to prevent the cell from changing the highlight:

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {}
    [super setHighlighted:NO animated:animated];
}

For more details, check out Removing text shadow in UITableViewCell when it's selected.

0

精彩评论

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

关注公众号