UIView的子类,不能设置自己的layer.cornerRadius?



我已经子类化了UIVIew来制作我的自定义视图。

-(UIMyMessageView*)init:(NSString*)withMessage
 {
   [super initWithFrame:messageFrame];
   // I Would like to do : 
   self->layer.cornerRadius = 8; // This doesn't compile
 }

为什么我无法设置自己的图层?

包括 QuartzCore Framework

#import <QuartzCore/QuartzCore.h>

此外,在项目中包括此框架。

http://meandmark.com/blog/2011/03/xcode-4-adding-a-framework-to-your-project/

你试过吗:

self.layer.cornerRadius = 8;

最新更新