Make sure that your imageView
getter method is getting the UIImageView
instance already stored in the instance variable _imageView
. Otherwise each time you call the imageView
method, you're creating a new instance of a UIImageView
, so you're not going to be setting the image on the instance that actually got added to your view.
So, here's how your imageView
method should look:
- (UIImageView *) imageView {
UIImageView *imageView = _imageView;
imageView.layer.cornerRadius = CGRectGetWidth(profilePhotoImageView.frame) / 2.0f;
imageView.layer.masksToBounds = YES;
imageView.backgroundColor = [UIColor redColor];
return imageView;
}