我将 UIVIew 子类化为自定义视图。
-(UIMyMessageView*)init:(NSString*)withMessage
{
[super initWithFrame:messageFrame];
// I Would like to do :
self->layer.cornerRadius = 8; // This doesn't compile
}
为什么我不能设置自己的图层?
我将 UIVIew 子类化为自定义视图。
-(UIMyMessageView*)init:(NSString*)withMessage
{
[super initWithFrame:messageFrame];
// I Would like to do :
self->layer.cornerRadius = 8; // This doesn't compile
}
为什么我不能设置自己的图层?
包括 QuartzCore 框架
#import <QuartzCore/QuartzCore.h>
还要在你的项目中包含这个框架。
http://meandmark.com/blog/2011/03/xcode-4-adding-a-framework-to-your-project/
你有没有尝试过:
self.layer.cornerRadius = 8;