Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9: Creating Custom Cells with Su... > Handling Selection in Custom Cells

Handling Selection in Custom Cells

If you change the cell's backgroundView property, the chances are you'll also need to control the way the cell is highlighted when it's selected.

Cell selection is controlled by UITableViewCell's selectionStyle property – this can be in one of three states:

  • UITableViewCellSelectionStyleNone
  • UITableViewCellSelectionStyleBlue
  • UITableViewCellSelectionStyleGray

When the selectionStyle value is set to None, there are no visible changes, but the other two causes the cell's background to appear to be filled with a solid color.

The cell also has two background views that sit behind the contentViewbackgroundView, which is shown by default; and selectedBackgroundView, which sits between backgroundView and contentView (and isn't displayed by default).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint