简体   繁体   中英

Subclass of UIView, can't set it's own layer.cornerRadius?

I have subclassed UIVIew to make my custom view.

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

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

Why can't I set my own layer?

include QuartzCore Framework

#import <QuartzCore/QuartzCore.h>

Also include this framework in your project.

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

你有没有尝试过:

self.layer.cornerRadius = 8;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM