Relaying Actions from UITableViewCells

Sometimes, it is useful to add a UIControl or one of its subclasses, like a UIButton, to a UITableViewCell. For instance, you want users to be able to tap the thumbnail image in a cell and see a full-size image for that item. In this section, you will do that by adding a transparent button on top of the thumbnail. Tapping this button will show the full-size image in a UIPopoverController when the application is running on an iPad.

Open BNRItemCell.m and stub out a method that will trigger showing the image.

- (IBAction)showImage:(id)sender
{

}

Now, in BNRItemCell.xib, drag a UIButton onto the content view. Remove the text from the button. Select both the UIImageView and UIButton, and then ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.