Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a subview to MasterView of UISplitViewController

I need to add a subview to left part of UIViewController, which shows the user that there is something near the left part of screen, when masterview is hidden(in portrait orientation). And this view must move with left part of UISplitView. Something like the view with arrow in these two images. (Sorry for the russian interface) http://s2.uploads.ru/8EHJI.png http://s2.uploads.ru/NhEam.png But my problem is that when I try to add such a view, it clips to bounds of masterview and is not visible when masterview is hidden. I think, I'm doing it wrong and there is an easy way to do this.

Update: I've tried to make some hack like:

-(void) clipToBoundsRecursive:(UIView *)someView
{
    NSLog(@"%@", someView);
    someView.clipsToBounds = NO;
    for (UIView *v in someView.subviews)
    {
        [self clipToBoundsRecursive:v];
    }
}

and send it to view of splitviewcontroller.

UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
[self clipToBoundsRecursive:splitViewController.view];

It takes effect at first time (subviews outside the masterview's bounds shows, but after first show/hide animation they disappears and don't appear even if I call this method again)

like image 792
Padavan Avatar asked Nov 25 '25 14:11

Padavan


1 Answers

You can add the view directly to the window's view, though you will have to manually manage its position depending on when the device rotates. Views added to the window.view will appear above the rootViewController.view.

like image 148
Tim Avatar answered Nov 27 '25 04:11

Tim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!