---
title: "#152: UITableView \u0026 UITableViewCell B-sides 📼"
url: https://littlebitesofcocoa.com/152-uitableview-uitableviewcell-b-sides
author: Jake Marsh
published: 2015-12-22
topics: ["UIKit","Table Views","B-sides"]
description: "We're continuing our look at lesser-known UIKit functionality today with UITableView \u0026 UITableViewCell. Let's see what we can find: We can set..."
---

# #152: UITableView & UITableViewCell B-sides 📼

By Jake Marsh, December 22, 2015. HTML: https://littlebitesofcocoa.com/152-uitableview-uitableviewcell-b-sides

We're [continuing our look](https://littlebitesofcocoa.com/151) at lesser-known **UIKit** functionality today with _UITableView & UITableViewCell_. Let's see what we can find:


## Blur & Vibrancy Visual Effects

We can set **UIVisualEffectView** `backgroundView`, and a **vibrancy** `separatorEffect` so our _table view_ really shines:


``` swift
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .Dark))

tableView.backgroundView = blurView
tableView.separatorEffect = UIVibrancyEffect(forBlurEffect: blurView.effect as! UIBlurEffect)
```

<img src="https://media.littlebitesofcocoa.com/bite-assets/152-uitableview-uitableviewcell-b-sides-effects.png" style="max-width: 81px;" />

## Row Actions

We can get those awesome "swipe-to-reveal" actions from **Mail.app** in our own _table views_. We just need to implement one delegate **function** and return an **array** of **UITableViewRowActions**.


``` swift
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
  let deployAction = UITableViewRowAction(
    style: .Default,
    title: "Deploy"
  ) { (action, indexPath) in
    // TODO: Deploy the troop at this indexPath.row
  }

  return [deployAction]
}
```

<img src="https://media.littlebitesofcocoa.com/bite-assets/152-uitableview-uitableviewcell-b-sides-actions.png" style="max-width: 304px;" />

## Adjusting to State Transitions

We can override the `willTransitionToState(state:)` and `didTransitionToState(state:)` **functions** in our _UITableViewCell_ **subclasses** to run code when the **cell** begins or finishes showing the **edit control** or delete confirmation:

``` swift
class StormtrooperCell : UITableViewCell {
  override func didTransitionToState(state: UITableViewCellStateMask) {
    super.didTransitionToState(state)

    if state == .ShowingEditControlMask { print("began editing!") }
  }
}
```

## Multiple Selection Background View

We can set a special **background view** on cells that will be shown only when we our _table view_ supports multiple selection:

``` swift
multipleSelectionBackgroundView = EditingView()
```
