user3898700
user3898700

Reputation: 141

how to highlight multiple rows in a table view using objective-C

If I touch first row, it will get highlighted. If I touch second row, first row highlighting is not there and second row is highlighted in table view of iOS. I want to highlight (multiple) both rows.

Here is my Code

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

UIView *selectionColor = [[UIView alloc] init];
selectionColor.backgroundColor = [UIColor grayColor];
cell.selectedBackgroundView = selectionColor;

}

Upvotes: 0

Views: 493

Answers (1)

Fawad Masud
Fawad Masud

Reputation: 12344

Use

self.tableView.allowsMultipleSelection = YES;

property of UITableView.

Upvotes: 3

Related Questions