在我的UICollectionViewCell类中,我写了这个:
- (void)layoutSubviews {
[super layoutSubviews];
self.myImageView.layer.cornerRadius = CGRectGetHeight(self.myImageView.frame) / 2;
self.myImageView.layer.masksToBounds = YES;
}
Run Code Online (Sandbox Code Playgroud)
但这在所有情况下都无法正常工作,它看起来像这样: