设置带圆角外发光阴影

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;

 

posted on 2019-02-15 13:49  土匪7  阅读(410)  评论(0编辑  收藏  举报