mainul
mainul

Reputation:

How to change the default blue color when selecting the row of UITableView

Duplicate:

can i use highlighted the table view cell without default blue color in objective c?

How can I change the default blue color when selecting the row of UITable?

Upvotes: 0

Views: 539

Answers (2)

larntin
larntin

Reputation: 110

in the delegate of the tableview, where you create the cell, you can custom it.

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

    static NSString *customCellIdentifier = @"customCellIdentifier ";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
        cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"YourBackground.png"]] autorelease];
    }

    // configure the cell
}

Upvotes: 0

pix0r
pix0r

Reputation: 31280

UITableViewCellSelectionStyle is built in to Cocoa Touch and will give you a few choices. For more customization, you'll need to change your cell manually:

How do I set UITableViewCellSelectionStyle property to some custom color?

Upvotes: 4

Related Questions