iphone - iDev 自定义标签栏模态窗口被标签栏隐藏。我怎样才能改变这个?

标签 iphone ios

我一直在尝试从我按照以下 iDev 教程/源代码实现的一个 View 中呈现模态视图。自定义选项卡栏通过将它们作为 subview 插入到选项卡栏下方来管理 View ,因此当我调用要从 subview 显示的模态视图时,它会在底部被选项卡栏覆盖。我已将以下代码切换到选项卡栏 subview 上方,这允许显示整个屏幕,但它仍然会产生动画问题。

 // Set the view controller's frame to account for the tab bar
viewController.view.frame = CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height-(tabBarGradient.size.height));

// Set the tag so we can find it later
viewController.view.tag = SELECTED_VIEW_CONTROLLER_TAG;

// Add the new view controller's view
[self.view insertSubview:viewController.view aboveSubview:tabBar];

http://idevrecipes.com/2011/01/04/how-does-the-twitter-iphone-app-implement-a-custom-tab-bar/

请帮忙,这让我抓狂!

最佳答案

所以,我认为您是从您的 subview 中呈现模态视图,如下所示:

[self presentModalViewController:someController animated:YES];

如果是这样,您的 Controller 将显示在当前 View (自身)上,如果当前 View 位于其他 View 下方 - 模态 Controller 也将显示在它们下方。 您应该获得对主父 View 的引用,以便您可以在那里调用 presentModalViewController。

在有很多 subview 的大项目中,引用主视图很方便,我是这样做的:

在 MyAppDelegate @interface 中我有:

{
UINavigationController *navController;
}
+ (UINavigationController *) navController;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;

在实现中:

// Used for showing modal windows over tabbar
static UINavigationController * _rootController = nil;

+ (UINavigationController *) navController {
    return _rootController;
}

@synthesize navController;

在 didFinishLaunchingWithOptions 中:

_rootController = navController;

(在这个例子中我的顶 View - 导航 Controller )

所以我可以在应用程序的任何地方调用:

[[MyAppDelegate navController] presentModalViewController:someController animated:YES];

关于iphone - iDev 自定义标签栏模态窗口被标签栏隐藏。我怎样才能改变这个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8179458/

相关文章:

ios - UIBarButtonItem setBackButtonTitlePositionAdjustment 不起作用

iphone - iphone如何连接无线鼠标?

ios - Fabric Archive 打包错误-6

iphone - 我可以从 iphone 应用程序发出 POST 或 GET 请求吗?

iphone - 如何为我的 iPod touch 编写程序?

ios - 填充 NSMutableArray 不工作

ios - CATextLayer 快速更改文本

iphone - 使用捏合手势缩放 UIImageView 时出现问题

iphone - 无法释放我的 appDelegate 变量

iphone - 在 iOS 上从前置扬声器播放音乐?