Circular UIImageView in UITableView without performance hit?

前端 未结 14 2713
失恋的感觉
失恋的感觉 2020-12-12 09:50

I have a UIImageView on each of my UITableView cells, that display a remote image (using SDWebImage). I\'ve done some QuartzCore

14条回答
  •  庸人自扰
    2020-12-12 10:14

    Simply set the cornerRadius to half of the width or height (assuming your object's view is square).

    For example, if your object's view's width and height are both 50:

    itemImageView.layer.cornerRadius = 25;
    

    Update - As user atulkhatri points out, it won't work if you don't add:

    itemImageView.layer.masksToBounds = YES;
    

提交回复
热议问题