简体   繁体   中英

UIView.layer.cornerRadius doesn't work inside uitableviewcell

I am using UITableView, and I have one UIImageView inside my UITableViewCell, so it set the cornerRadius of the UIImageView, but it doesn't work. How can I fix it?

that is my function to set the content of the cell, and I called it in tableviewdelegate of cellForRowAtIndexPath:

 func setContentWithUser(#user: UserMapper) -> Void { if let avatarUrl = user.avatar{ self.avatarImageView.layer.cornerRadius = 3 loadImage(url: avatarUrl, { (image) -> Void in self.avatarImageView.image = image }) } nameLabel.text = user.name ?? "Unknown" titleLabel.text = "blabla" hospitalLabel.text = "blabla" aboutLabel.text = "blabla"" } 

尝试添加以下内容:

self.avatarImageView.cliptobounds = true

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