我有一张 table ..我尝试在每一行中显示该图像。
但是当我这样做时
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"BlueLong.png"]];
结果是这样的..
第一行是正确的..但之后它就像图像的上侧被切割..? 我该如何解决这个问题?
已经!
最佳答案
stretch.png - 这是缩小为阴影和形状的图像
cell.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"stretch.png"] stretchableImageWithLeftCapWidth:21.0 topCapHeight:15.0]];
21和15是尺寸为42x31像素的图像的中心
编辑:这应该有效
cell.backgroundColor = [UIColor clearColor];
cell.backgroundView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"stretch.png"] stretchableImageWithLeftCapWidth:21 topCapHeight:15]];
关于objective-c - 行背景被切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7145262/