Skip to content

Instantly share code, notes, and snippets.

@tanshio
Created October 10, 2015 00:52
Show Gist options
  • Save tanshio/a602c137d27bc424be73 to your computer and use it in GitHub Desktop.
Save tanshio/a602c137d27bc424be73 to your computer and use it in GitHub Desktop.
Static Cells時の選択色を変更する ref: http://qiita.com/tanshio/items/26ed81d5fd15268abff4
UIView *backgroundSelectedCell = [[UIView alloc] init];
[backgroundSelectedCell setBackgroundColor:[UIColor colorWithRed:130/256.0 green:169/256.0 blue:171/256.0 alpha:1.0]];
for (int section = 0; section < [self.tableView numberOfSections]; section++)
for (int row = 0; row < [self.tableView numberOfRowsInSection:section]; row++)
{
NSIndexPath* cellPath = [NSIndexPath indexPathForRow:row inSection:section];
UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:cellPath];
[cell setSelectedBackgroundView:backgroundSelectedCell];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment