Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode5 iOS7 - UIPopoverController Corner Radius

I'm transitioning an application to iOS 7 which has been fairly smooth, there's one thing I cannot figure out.

I have a view controller with a couple buttons that I display with a UIPopoverController.

It looks to me like the popover controller is doing something to clip the content of it's view controller to be rounded.

iOS6 (I want this):

enter image description here

iOS7 (something changed):

enter image description here

I'm using custom popover controller background class described here http://blog.teamtreehouse.com/customizing-the-design-of-uipopovercontroller

Here's my specific version of that background class http://pastebin.com/fuNjBqwU

Does anyone have any idea what to change to get it back to my iOS 6 look?

like image 226
gngrwzrd Avatar asked Sep 18 '13 21:09

gngrwzrd


2 Answers

In popover content controller:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.view.superview.layer.cornerRadius = 0;
}
like image 74
OneSman7 Avatar answered Sep 18 '22 15:09

OneSman7


I tried getting @OneSman7's solution to work, but the view with the cornerRadius wasn't the direct superview of the contentViewController.view instance. Instead, I had to walk up the view hierarchy searching for the one whose cornerRadius is no 0 and reset it (which is just a UIView instance, no special class name to check for). A less than ideal solution, but seems to work so far.

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        UIView *view = self.view;
        while (view != nil) {
            view = view.superview;
            if (view.layer.cornerRadius > 0) {
                view.layer.cornerRadius = 2.0;
                view = nil;
            }
        }
    }
}
like image 42
u10int Avatar answered Sep 22 '22 15:09

u10int