MartinW
MartinW

Reputation: 248

Stretching An Image in Tableview

What else is needed to display image to full tableview width?

UIImage *image = [UIImage imageNamed:@"balloon_2.png"]; 
[image stretchableImageWithLeftCapWidth:15 topCapHeight:13]; 
cell.image = image;

Upvotes: 1

Views: 902

Answers (1)

VoidPointer
VoidPointer

Reputation: 17831

stretchableImageWithLeftCapWidth:topCapHeight: returns a new UIImage. You need to do something like

UIImage *image = [UIImage imageNamed:@"balloon_2.png"]; 
UIImage *strImage = [image stretchableImageWithLeftCapWidth:15 topCapHeight:13]; 
cell.image = strImage;

... or just assign the result of the message to cell.image right away.

See also: UIImage reference

Upvotes: 1

Related Questions