うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

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

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
}