0

The ImageView dosen't appear after using clipsToBounds for making it round, but if i remove these lines it shows on the storyboard.

Here is a snip for the code:

(void)viewDidLoad {[super viewDidLoad];


self.ProfilePhotoImageView.layer.cornerRadius = self.ProfilePhotoImageView.frame.size.width / 2;
self.ProfilePhotoImageView.clipsToBounds = YES;

self.ProfilePhotoImageView.layer.borderWidth = 3.0f;
self.ProfilePhotoImageView.layer.borderColor = [UIColor whiteColor].CGColor;
// Do any additional setup after loading the view. 
}
Mischiefz
  • 127
  • 16
Vinn
  • 21
  • 6

2 Answers2

1

Place the above code in viewWillAppear method and check.

Like,

-(void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    self.ProfilePhotoImageView.layer.cornerRadius = self.ProfilePhotoImageView.frame.size.width / 2;
    self.ProfilePhotoImageView.clipsToBounds = YES;

    self.ProfilePhotoImageView.layer.borderWidth = 3.0f;
    self.ProfilePhotoImageView.layer.borderColor = [UIColor whiteColor].CGColor;

}
Ronak Chaniyara
  • 5,335
  • 3
  • 24
  • 51
  • I have placed the above code in -(void)viewWillAppear. I have the above image as profile pic in a view of page view controller now the problem is until i turn over that page again the image is not loading in that view but once i scroll through the page view controller and come back the image gets to display. – Vinn Oct 27 '16 at 09:49
0

If you need the imaged load on viewDidLoad() simple add

 [self layoutIfNeeded];

previous the cornerRadious setup.

Ref: iOS 10 GM with xcode 8 GM causes views to disappear due to roundedCorners & clipsToBounds

Community
  • 1
  • 1
Ber.to
  • 1,064
  • 1
  • 10
  • 15