Search code examples
iosobjective-cios9

Rounded views not working in iOS 9


I have a code that takes a view and rounds it corners - turning it into a circle:

imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 8, 8)];
imageView.layer.cornerRadius = imageView.frame.size.width/2;
imageView.layer.masksToBounds = YES;

This works great on iOS 7 and iOS 8 - but doesn't work on iOS 9. How can I fix it?


Solution

  • Turns out adding a background color to the ImageView fixes the issue...