简体   繁体   中英

How to change UITableViewCell Image to Circle in UITableView if width and height are different

My code is imv.clipsToBounds=YES; imv.layer.cornerRadius=imv.frame.size.width/2;

imv.layer.borderWidth = 4.0;

The best solution would be to either resize your image view to be square (using autolayout or manually set the frame) or even better you could redraw the image using an image context with a circular clipping mask, then you wouldn't have performance problems on older devices because of corner radii that you recompute on scrolling.

Something like here https://stackoverflow.com/a/17722702/384309

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM