2009-08-18 85 views
1

还需要什么才能将图像显示为全桌面视图宽度?在桌面视图中拉伸图像

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

回答

1

stretchableImageWithLeftCapWidth:topCapHeight:返回一个新的UIImage。 你需要做的是这样

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

...或只是分配消息的结果马上cell.image。

参见:UIImage reference

+0

改变了这一运行时现在得到的异常: 'NSInvalidArgumentException' 的,理由是: '*** - [UICGColor stretchableImageWithLeftCapWidth:topCapHeight:]:无法识别的选择发送到实例0x529900' 参数不要虽然看起来不错? – MartinW 2009-08-22 11:17:57