How to change the blue selection of a UITableViewCell

 
You have to just put this code into “cellForRowAtIndexPath”
For disable the cell select:(While Clicking the cell)
cell.selectionStyle = UITableViewCellSelectionStyleNone;

For enable the cell:(While Clicking the cell)

cell.selectionStyle = UITableViewCellSelectionStyleBlue;(By Default)

cell
.selectionStyle = UITableViewCellSelectionStyleGray;

If you want to give your custom colour then in cellForRowAtIndexPath”

if (cell==nil)
{  
 cell
= [[[UITableViewCell alloc] initWithStyle:
 UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
 
UIView *v = [[[UIView alloc] init] autorelease];
    v
.backgroundColor = [UIColor redColor];
    cell
.selectedBackgroundView = v;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>