@implementation cuiview
-(instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor orangeColor];
//v.layer.masksToBounds=YES;这行去掉
self.layer.cornerRadius = 10;
self.layer.shadowColor = [[UIColor redColor] CGColor];
self.layer.shadowOffset = CGSizeMake(0, 0);
self.layer.shadowOpacity = 0.5;
self.layer.shadowRadius = 5;
}
return self;
}
cuiview *cui = [[cuiview alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:cui];
UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
imageview.layer.cornerRadius=10;
imageview.clipsToBounds=YES;
[imageview sd_setImageWithURL:[NSURL URLWithString:@"http://img4.bitautoimg.com/autoalbum/files/20101220/862/13374086240035_1469891_15.JPG"]];
[cui addSubview:imageview];