设置带圆角外发光阴影

UIView *shadowView = [[UIView alloc] initWithFrame:CGRectMake(WIDTH_WITH6(leftM), WIDTH_WITH6(top), [UIScreen mainScreen].bounds.size.width - WIDTH_WITH6(leftM) * 2, 100)];
    [self.contentView addSubview:shadowView];
    shadowView.layer.shadowColor = [UIColor redColor].CGColor;
    shadowView.layer.shadowOffset = CGSizeZero; // CGSizeMake(0, 0);
    shadowView.layer.shadowOpacity = 0.3;
    shadowView.layer.shadowRadius = 5.0;
    
    UIView *mainView = [[UIView alloc] initWithFrame:shadowView.bounds];
    [shadowView addSubview:mainView];
    mainView.backgroundColor = [UIColor whiteColor];
    mainView.layer.cornerRadius = 5;
    mainView.clipsToBounds = YES;

猜你喜欢

转载自www.cnblogs.com/tufei7/p/10383263.html