cell添加阴影效果(不是给定阴影图片)

来源:互联网 发布:海南网络广播电视台 编辑:程序博客网 时间:2024/05/17 05:51

添加阴影

-(void)layoutSubviews{

    [superlayoutSubviews];

    self.layer.shadowColor = [UIColorblackColor].CGColor;

    self.layer.shadowOpacity = 0.6;

    self.layer.shadowRadius = 2.0;

    self.layer.shouldRasterize =YES;

    self.layer.rasterizationScale = [UIScreenmainScreen].scale;

    CGPathRef path = [UIBezierPathbezierPathWithRect:CGRectMake(0,self.bounds.size.height, [UIScreen mainScreen].bounds.size.width,2)].CGPath;

    [self.layersetShadowPath:path];

}

添加分割线

-(void)drawRect:(CGRect)rect{

    CGContextRef context =UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [UIColorwhiteColor].CGColor);

    CGContextFillRect(context, rect);

    

    CGContextSetStrokeColorWithColor(context,  [UIcolorExternhexStringToColor:@"e5e5e5"].CGColor);

    CGContextStrokeRect(context,CGRectMake(14, rect.size.height - 0.5, rect.size.width-14, 0.5));

}


0 0
原创粉丝点击