Making a 'hole' in a UITabBarController or UINavigationController?

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).

My code, the the app delegate, for creating the tabs is:

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];

Here's how I'd like it to work:

|                           |
|     ---------------       |
|     |             |       |
|     | hole which  |       |
|     | shows the   |       |
|     | same view   |       |
|     | in each tab |       |
|     ---------------       |
|                           |
|                           |
|            |              |
|   tab 1    |   tab 2      |
|            |              |

There's a thread here about transparent rectangles - iPhone - Draw transparent rectangle on UIView to reveal view beneath - 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?


Why not just add an UIView (which will act as a "hole") on top of the Tab-bar controller?

You may just add it to application's UIWindow, like this, in application:didFinishLaunchingWithOptions::

// ...
self.window.rootViewController = self.tabBarController;

MyView *holeView = [[MyView alloc] initWithFrame:CGRectMake(hole coordinates)];
[self.window addSubview:holeView];
[holeView release];

[self.window makeKeyAndVisible];

Need Your Help

using jetty to test a method that performs http post

java junit jetty

I am writing a junit test for a program that performs HTTP post, I am trying to use jetty to handle the request, but I can't find good examples or explanation on how to use it for that purpose, does

fwrite file output is wrong

c file binary little-endian

I am trying to write a binary representation of the integer into a file , accepted that I will get hexadecimal format in the file, however I don't get the expected result.