Search This Blog

Friday, 16 November 2012

How to change the selectedRow textColor in tableView for xcode

Hello friends,
                 Here it is a simple but sometimes useful for how to change the text color on row selection in TableView for xcode:


In function:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{


Do this :
cell.textLabel.textColor = [UIColor white Color];
cell.textLabel.highlightedTextColor = [UIColor blackColor];

 cell.detailTextLabel.textColor = [UIColor grayColor];
cell.detailTextLabel.highlightedTextColor = [UIColor redColor];

here what will happen , on initial loading the color for textLabel and detail text Label will be white and gray respectively,on selecting the row the color will change to black for textLabel and red for detailTextLabel.

Ask for any queries....

No comments:

Post a Comment