设置阴影路径可避免离屏渲染
-(UIView *)shadowView{
if (!_shadowView) {
_shadowView = [[UIView alloc] init];
_shadowView.frame = CGRectMake(0,0,NEARBY_Grid_W,NEARBY_Grid_H);
_shadowView.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1].CGColor;
_shadowView.layer.cornerRadius = 5;
_shadowView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor;//阴影的颜色
_shadowView.layer.shadowOffset = CGSizeMake(0,2);//阴影偏移量
_shadowView.layer.shadowOpacity = 1;//阴影的透明度
_shadowView.layer.shadowRadius = 5;//阴影的圆角
_shadowView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:_shadowView.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)].CGPath;//参数依次为大小,设置四个角圆角状态,圆角曲度 设置阴影路径可避免离屏渲染
[self.contentView addSubview:_shadowView];
}
return _shadowView;
}