Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking a 'hole' in a UITabBarController or UINavigationController?
    primarykey
    data
    text
    <p>How would I 'punch a hole' in a tab bar app, whereby a tab-bar based app can show a view behind the uinavigationcontrollers that are in each tab? (this punch could be optionally turned off). </p> <p>My code, the the app delegate, for creating the tabs is:</p> <pre><code>OneRootViewController *oneRootViewController = [[OneRootViewController alloc] initWithNibName:@"OneRootViewController" bundle:nil]; UINavigationController *oneNav = [[UINavigationController alloc] initWithRootViewController:oneRootViewController]; oneNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"One" image:[UIImage imageNamed:@"one.png"] tag:0]; TwoRootViewController *twoRootViewController = [[TwoRootViewController alloc] initWithNibName:@"TwoRootViewController" bundle:nil]; UINavigationController *twoNav = [[UINavigationController alloc] initWithRootViewController:twoRootViewController]; twoNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Two" image:[UIImage imageNamed:@"two.png"] tag:1]; self.tabBarController = [[UITabBarController alloc] init]; self.tabBarController.viewControllers = [NSArray arrayWithObjects:oneNav, twoNav, nil]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; </code></pre> <p>Here's how I'd like it to work:</p> <pre><code>----------------------------- | | | --------------- | | | | | | | hole which | | | | shows the | | | | same view | | | | in each tab | | | --------------- | | | | | ----------------------------- | | | | tab 1 | tab 2 | | | | ----------------------------- </code></pre> <p>There's a thread here about transparent rectangles - <a href="https://stackoverflow.com/questions/3800278/iphone-draw-transparent-rectangle-on-uiview-to-reveal-view-beneath">iPhone - Draw transparent rectangle on UIView to reveal view beneath</a> - but I'm not sure how to do it in my case.. would I subclass my nav controller or tab bar controller (is it legal to even do that), and if so, how would I make the hole optional?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload