I have a modal view popping up in my iPad app and for some reason it has white, rounded corners.
It might be worth noting I built this model view in my storyboard, not programmatically. However, in my viewWillAppear method, I'm setting the corner radius like so...
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.view.layer.cornerRadius = 6.0f;
}
When I set the value above 6, the white corners become visible. How can I set the value higher without these white rounded corners showing?
Thanks so much in advance for your wisdom!
Your question is ambiguous about what kind of presentation you're using for your view controller, so I'm going to assume you're using a form sheet. The solution is to set the superview's background color to [UIColor clearColor]
to prevent the translucent background from appearing:
- (void) viewDidAppear:animated
{
[super viewDidAppear:animated];
self.view.layer.cornerRadius = 10;
self.view.layer.masksToBounds = YES;
self.view.superview.backgroundColor = [UIColor clearColor];
}
Before setting backgroundColor
:
After setting backgroundColor
:
Try
[self.view superview].layer.cornerRadius = 21.0f;
[self.view superview].layer.masksToBounds = YES;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With