【问题标题】:Preview rounded image in iphone在 iphone 中预览圆形图像
【发布时间】:2011-01-27 18:28:25
【问题描述】:

谁能告诉我如何在自定义单元格中创建图像预览,其中包含在 mms 中加载的内容。

我一直在尝试通过更改 IB 中的值来做到这一点,但我无法做到。

非常感谢!


(来源:iphonehelp.in


感谢三个答案。

在做

cell3.imageView.layer.masksToBounds = YES;
cell3.imageView.layer.cornerRadius = 16;
cell3.imageView.layer.borderColor = [UIColor lightGrayColor].CGColor;
cell3.imageView.layer.borderWidth = 1.0; 

我能够做我想做的部分事情。但是,我仍然无法将那种“发光”的外观放在图像上。有人现在应该控制哪个财产吗?

非常感谢(再次感谢)。

【问题讨论】:

    标签: iphone objective-c xcode interface-builder uiimageview


    【解决方案1】:

    当然。将 QuartzCore 框架添加到您的项目中,然后:

    #import <QuartzCore/QuartzCore.h>
    // ...
    cell.imageView.layer.masksToBounds = YES;
    cell.imageView.layer.cornerRadius = 4;
    

    请注意,cornerRadius 属性仅适用于 OS 3.0 及更高版本;如果您支持较旧的版本(您可能不必支持),则需要做一些 Core Graphics 工作。

    【讨论】:

      【解决方案2】:

      在图像编辑器中创建图像然后将其设置为单元格的背景不起作用吗?

      这可能对你有用 http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

      【讨论】:

        【解决方案3】:

        如果您的图像在图像视图中并且您的目标是 OS 3.0+,您可以设置imageView.layer.cornerRadius

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多