今天在工作的時候,需要設置用戶的頭像爲圓形,但是我設置了很久都無效果,代碼如下,效果如下:
// 添加頭像
headIcon.image = [UIImage imageNamed:image];
headIcon.layer.borderColor = [[UIColor whiteColor]CGColor];
headIcon.layer.borderWidth = 2;
headIcon.layer.cornerRadius=25;
headIcon.layer.backgroundColor = [[UIColor whiteColor]CGColor];
[headView addSubview:headIcon];