【发布时间】:2012-01-10 16:22:20
【问题描述】:
如何在标签栏应用程序中“打孔”,从而基于标签栏的应用程序可以显示每个标签中的 uinavigationcontrollers 后面的视图? (可以选择关闭此打孔器)。
我的代码,应用程序委托,用于创建选项卡是:
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];
这是我希望它的工作方式:
-----------------------------
| |
| --------------- |
| | | |
| | hole which | |
| | shows the | |
| | same view | |
| | in each tab | |
| --------------- |
| |
| |
-----------------------------
| | |
| tab 1 | tab 2 |
| | |
-----------------------------
这里有一个关于透明矩形的线程 - iPhone - Draw transparent rectangle on UIView to reveal view beneath - 但我不知道在我的情况下该怎么做.. 我会将我的导航控制器或标签栏控制器子类化(甚至这样做是否合法),如果是这样,我如何让这个洞成为可选的?
【问题讨论】:
-
你需要记住,计算机不会想到孔,他们只会想到完整的对象,所以也许你想使用层?
标签: iphone ios uinavigationcontroller uitabbarcontroller