【问题标题】:Stretching An Image in Tableview在 Tableview 中拉伸图像
【发布时间】:2009-08-18 22:02:26
【问题描述】:

还需要什么才能将图像显示为完整的 tableview 宽度?

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

【问题讨论】:

    标签: objective-c iphone uiimage


    【解决方案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

    【讨论】:

    • 更改了这一点,现在运行时出现异常:'NSInvalidArgumentException',原因:'*** -[UICGColor stretchableImageWithLeftCapWidth:topCapHeight:]: unrecognized selector sent to instance 0x529900' 不过参数似乎没有错?
    猜你喜欢
    • 2011-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 2011-01-07
    • 2012-09-09
    • 1970-01-01
    相关资源
    最近更新 更多