-2

我将 UIVIew 子类化为自定义视图。

-(UIMyMessageView*)init:(NSString*)withMessage
 {
   [super initWithFrame:messageFrame];

   // I Would like to do : 
   self->layer.cornerRadius = 8; // This doesn't compile
 }

为什么我不能设置自己的图层?

4

2 回答 2

3

包括 QuartzCore 框架

#import <QuartzCore/QuartzCore.h>

还要在你的项目中包含这个框架。

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

于 2012-11-30T10:28:17.577 回答
1

你有没有尝试过:

self.layer.cornerRadius = 8;
于 2012-11-30T10:27:21.400 回答