UITableViewCell action icon

Does anyone know how to implement an action icon like the ones below with price tags in them. The App Store has it too.

alt text http://m.macupdate.com/images/screens/uploaded/30815_scr.png

0


a source to share


2 answers


The easiest way is to set the accessoryView

default UITableViewCell

to UIView

. You can just make them default UIButtons

, set their background color and label color and font.

If they are not designed for interactivity, you can use a container UIView

with UIImageView

in the background and UILabel

in the beginning, added as subtitles.



If you want to get an idea of ​​this, you will have to subclass UITableViewCell

and lay out the various bits yourself. It's not that hard. The example code TableViewSuite

shows how to do this.

+1


a source


I'm not sure if this framework has all the possibilities to create this type of button. You can simulate it quite easily using your own images. What you want in this case is a stretchable image that doesn't distort when the buttons are resized.

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



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

+1


a source







All Articles