我想實現投影陰影和圓角在UITableViewCell
。如何在UITableViewCell中實現帶圓角的陰影?
- (void)tableView:(UITableView *)tableView willDisplayCell:(MembershipCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.contentView.backgroundColor = [UIColor clearColor];
CGRect rect = cell.frame;
UIView *whiteRoundedCornerView = [[UIView alloc] initWithFrame:CGRectMake(8,8,rect.size.width-8,rect.size.height)];
whiteRoundedCornerView.backgroundColor = [UIColor whiteColor];
whiteRoundedCornerView.layer.masksToBounds = NO;
whiteRoundedCornerView.layer.cornerRadius = 3.0;
whiteRoundedCornerView.layer.shadowOffset = CGSizeMake(0,0);
whiteRoundedCornerView.layer.shadowOpacity = 0.75;
[cell.contentView addSubview:whiteRoundedCornerView];
[cell.contentView sendSubviewToBack:whiteRoundedCornerView];
}
我使用上面的代碼,但它顯示在單元格的頂部和左側的陰影。
沒有得到您的問題,但正在尋找'shadowRadius'? – Mahesh