How to change UITableViewCell Image to Circle in UITableView

前端 未结 11 1493

My code works for the most part.

  • The issue I am having is the images start out as square, and change to circle when I scroll the table or refresh it.

11条回答
  •  执笔经年
    2021-02-12 12:32

    Its simple..

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        cell.ImageView.layer.cornerRadius = 150.0f;
        cell.ImageView.layer.borderWidth = 2.0f;
        cell.ImageView.layer.borderColor = [UIColor blackColor].CGColor;
        cell.ImageView.clipsToBounds = YES;
    }
    

    Refer this link for more information: http://ios-blog.co.uk/tutorials/quick-tips/how-to-create-rounded-avatars-in-your-ios-application/

提交回复
热议问题