I have a custom UITableViewCell
subclass. I have set the contentView
of my cell subclass to
a custom UIView
class in which i am overr
An excellent resource on customizing UITableViews has been this post by Matt Gallagher. What you'll want to do is set the selectedBackgroundView to a new view (instead of nil) that is either transparent or a UIImageView.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
How about this?
// disable user interaction
cell.userInteractionEnabled = NO;
What has worked for me in the past is just putting:
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { }
In my UITableViewCell subclasses (because it won't call super and make itself highlighted). Hope this is what you were looking for.
By far the easier method - in my opinion - to achieve this, is by setting the Table View attributes checkbox in the Interface Builder screen where it says "Show Selection on Touch". See the screenshot below:
You must also override setHighlighted: to prevent the blue gradient from ever showing. If you just override setHighlighted: then you end up with a momentary selection effect.
so you'll have these two methods:
- (void)setHighlighted: (BOOL)highlighted animated: (BOOL)animated
{
// don't highlight
}
- (void)setSelected: (BOOL)selected animated: (BOOL)animated
{
// don't select
//[super setSelected:selected animated:animated];
}