Achieving a single UIBlurEffect in the main UISplitView

I am using stock UISplitViewController

with pre-made view controllers Master

and Detail

. In the storyboard, I added a controller UIImageView

to the controller Detail

to effectively fill the view with a single image.

In a controller, Master

I used the following to blur the background of that controller:

// In viewDidLoad

self.tableView.backgroundColor = [UIColor clearColor];
    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc]
                                            initWithEffect:blurEffect];
    self.tableView.backgroundView = visualEffectView;
    self.tableView.separatorEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect];

      

When the controller Master

appears above the controller Detail

, notice how Master

there is a dark shadow at the edges of the controller around the inner edges.

How can you remove those "shadows" to create a uniform blur instead?

Split View Controller

More details

UIPopoverSlidingChromeView

Debugging the view hierarchy in IB reveals a view (private?) Called _UIPopoverSlidingChromeView

. It has a gray inset border and is definitely what's responsible for the uneven appearance of the blur.

Disabling preview blur altogether and just leaving it self.tableview.backgroundColor = [UIColor clearColor]

shows a _UIPopoverSlidingChromeView

gray frame. It looks like this:

Rendered UIPopoverSlidingChromeView

Any thoughts on how to avoid _UIPopoverSlidingChromeView

when using UISplitViewController

?

+3


source to share


2 answers


The problem is that this is a private class that you cannot test with.

Fortunately, it _UIPopoverSlidingChromeView

is a subclass UIPopoverBackgroundView

that is publicly available (because in a normal thread implementation thread, the client can customize the focal chrome by creating a class that subclasses UIPopoverBackgroundView

).



for (UIView *subview in self.viewController.view.superview.superview.subviews) {
    if ([subview isKindOfClass:[UIPopoverBackgroundView class]]) {
        subview.alpha = 0.0;
    }
}

      

It should hide _UIPopoverSlidingChromeView

.

+1


source


    //       maser    UISplitViewControllerDisplayModeOverlay
    CALayer* v_1 =  self.view.superview.superview.superview.layer.sublayers[0];
    CALayer* v_2=v_1.sublayers[0];
    v_2.borderWidth=0;

      



+3


source







All Articles