3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Static Cells時の選択色を変更する

Posted at

ViewDidLoad時に以下のコードを書く



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];
    }  

引用元:How to change background selected color storyboard static cells

キャッシュが云々というコメントはあるけど、スクロールしない場合問題はないと思う。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?