首页 > 代码库 > view添加阴影

view添加阴影

    //@mg:masksToBounds必须为NO否者阴影没有效果

//    cell.layer.masksToBounds = NO;

    cell.layer.contentsScale = [UIScreen mainScreen].scale;

    cell.layer.shadowOpacity = 0.15f;

    cell.layer.shadowRadius = 2.0f;

    cell.layer.shadowOffset = CGSizeMake(0,0);

    cell.layer.shadowPath = [UIBezierPath bezierPathWithRect:cell.bounds].CGPath;

    //设置缓存

    cell.layer.shouldRasterize = YES;

    //设置抗锯齿边缘

    cell.layer.rasterizationScale = [UIScreen mainScreen].scale;

view添加阴影