tags:

views:

875

answers:

2
A: 

The easiest way is to set the accessoryView of a standard UITableViewCell to a UIView. You can just make them be standard UIButtons, set their background color and the label color and font.

If they're not meant to be interactive, then you can use a container UIView with a UIImageView in the background and a UILabel in the front added as subviews.

If you want to get fancy with it you'll have to subclass UITableViewCell and lay out the various bits yourself. It's not that difficult. The TableViewSuite sample code shows you how.

Ramin
UIButtons sound like the way to go. However in the screenshot above, there is some kind of inner shadow and the bgcolor is more like a gradient. Is it an image or is it a UIButton property I'm missing? Thanks!
Sam V
It's probably a button with an image background. One clue is if the app does something different if you tap on the button part vs. the cell itself. If they both do the same thing then the accessoryView is probably a UIImageView. If it does something different then it's probably a UIButton.
Ramin
A: 

I am not sure there is anyway within the framework to create this type of button. You could fairly easily simulate it using your own custom images. What you want in this case is a stretchable image that does not distort as you resize the buttons.

Take a look at the following method on the UIImage class:

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

Lounges