Can't draw in UITableViewCell's drawRect

≡放荡痞女 提交于 2019-12-03 15:04:22
NRitH

You probably shouldn't do this in UITableViewCell's own drawRect. Instead, create a custom UIView and add it as a subview.

See also this answer.

Try set backgroungcolor property to transparent color

self.backgroundColor = [UIColor clearColor]
Max

You have to set

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
       .....
       [cell setNeedsDisplay];
       return cell;
}
chenghao

Try set backgroundColor of contentView property to clear color

self.contentView = [UIColor clearColor];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!