Add button to UITableViewCell's Accessory View

Try this block of code instead of the block you provided above:

UIButton *downloadButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[downloadButton setTitle:@"Download" forState:UIControlStateNormal];
[downloadButton setFrame:CGRectMake(0, 0, 100, 35)];
[tableView cellForRowAtIndexPath:indexPath].accessoryView = downloadButton;

This should display the button, but you will still need to hook up some kind of selector to it using addTarget. (I am not sure if listening in for the accessoryButtonTappedForRowWithIndexPath delegate will work in this case, try that first and see if it fires on your button press.)


I had the same problem. Attempting to set the accessoryView to a UIButton which had an image caused it to not appear.

The trick was to call [UIButton sizeToFit], to ensure its frame is set properly.


Assign the button as the accessory view rather than a subview of the accessory view.

UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryView = downloadButton;