//当用到UITableView 时。往往背景图片要根据内容的大小而定。但如果不用stretchableImageWithLeftCapWidth。刚图片拉出来会很难看。 //图片自动适应内容大小 UIImage *chatImage=[UIImage imageNamed:@"bubble.png"]; chatImage = [chatImage stretchableImageWithLeftCapWidth:22 topCapHeight:14]; NSLog(@"tbvContentSizeForLines:%f",tbvContentSizeForLines.width); cell.resultChatImageView.frame = CGRectMake(10, 44, tbvContentSizeForLines.width+25, cell.resultPersonTbvContent.numberOfLines*26+8); cell.resultChatImageView.image = chatImage;

本文介绍如何使用UIImage的stretchableImageWithLeftCapWidth方法,使UITableView的背景图片能够根据内容大小自动调整,避免图片拉伸失真,保持良好的视觉效果。
1122

被折叠的 条评论
为什么被折叠?



