LoginSignup
15
14

More than 5 years have passed since last update.

[Swift] 選択された Cell の背景色を変更

Posted at
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  var cell = tableView.dequeueReusableCellWithIdentifier("{cellIdentifier}", forIndexPath: indexPath) as! HogeCell

  // セルの背景色はなし
  cell.backgroundColor = UIColor.clearColor()

  // 選択された背景色を白に設定
  var cellSelectedBgView = UIView()
  cellSelectedBgView.backgroundColor = UIColor.whiteColor()
  cell.selectedBackgroundView = cellSelectedBgView


  return cell
}      
15
14
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
15
14