iOS:错误:访问属性的未知'cornerRadius'组件

时间:2011-06-15 10:08:18

标签: ios ipad

我得到以下异常让我发疯:

error: accessing unknown 'cornerRadius' component of a property

这是代码行:

    cell.imageView.layer.cornerRadius = 20.0;

我从2010年12月开始学习本教程:http://www.raywenderlich.com/2502/introduction-to-calayers-tutorial

根据文档,UIImageView是一个UIView。它有一个CALAyer。 CALayer具有cornerRadius属性。我在iOS 4.0上。

感谢

2 个答案:

答案 0 :(得分:7)

使用

#import <QuartzCore/QuartzCore.h>

答案 1 :(得分:1)

您是否正确导入了QuartzCore?

 #import <QuartzCore/QuartzCore.h>