设置cell圆角:
cell.contentView.layer.cornerRadius =2.0f;
cell.contentView.layer.borderWidth =1.0f;
cell.contentView.layer.borderColor = [UIColor clearColor].CGColor;
cell.contentView.layer.masksToBounds =YES;
经测试,这方法无效,具体原因,后期补上。
关键代码: cell.layer.cornerRadius = 2.0f;
写上这句就可以完美展现圆角效果,不过考虑到性能优化和离屏渲染问题,建议让UI设计师直接给圆角背景图是优选 (#^.^#)
设置cell阴影:
cell.layer.shadowColor = [UIColor lightGrayColor].CGColor;
cell.layer.shadowOffset = CGSizeMake(0,2.0f);
cell.layer.shadowRadius =2.0f;
cell.layer.shadowOpacity =1.0f;
cell.layer.masksToBounds =NO;
cell.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:cell.bounds cornerRadius:cell.contentView.layer.cornerRadius].CGPath;
(目前测试阴影还未测试,暂时写上此方法,有什么见解的童鞋欢迎留言指点江山)