Referencing this answer, I'm trying to make a UIImageView display a circular image. I generated a mask and tried using that image to mask it but that didn't work either.
When I try to mask the image, or change the corners nothing happens.
That's this:
[proPic.layer setCornerRadius:proPic.frame.size.width/2];
When I call [proPic.layer setMasksToBounds:YES];
the image disappears completely. Same thing when I tried using a third party library to mask the image.
Any advice?
EDIT:
//Profile Picture
proPic = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"DummyProPic"]];
//Mask Profile Picture to be circular
[proPic.layer setCornerRadius:proPic.frame.size.width/2];
//With this line added, the picture disappears
//Without this line, nothing is done to mask the image
[proPic.layer setMasksToBounds:YES];
[self.contentView addSubview:proPic];
[proPic mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView.mas_top).with.offset(padding.top);
make.centerX.equalTo(self.contentView.mas_centerX);
make.height.equalTo(@120);
make.width.equalTo(@120);
}];