I am developing an iPhone application, in my table view I wanted custom color for Cell Selection Style, I read the UITableViewCell Class Reference but there are only three constants defined for Selection style (Blue, Gray, None). I saw one application that used a different color than those defined in the reference.
How can we use a color other than those defined in the reference?
The best way to set the selection is to set the
selectedBackgroundViewon the cell when you construct it.i.e.
The image used should have a nice gradient (like the default selection). If you just want a flat color, you can use a UIView instead of a
UIImageViewand set thebackgroundColorto the color you want.This background is then automatically applied when the row is selected.