如何在导航控制器栏上覆盖视图?

发布于 2024-10-10 03:40:16 字数 1213 浏览 1 评论 0原文

我有点小问题。我正在尝试向我的应用程序添加一个 popoverview,但 popoverview 的一部分被我的导航控制器栏隐藏了。如何使我的 popoverview 覆盖在导航控制器栏的顶部?这是问题的图片: http://img593.imageshack.us/img593/4056/viewn.jpg

这是我正在使用的代码:

- (IBAction)onButtonClick:(UIButton *)button {

if (self.popoverController) {
    [self.popoverController dismissPopoverAnimated:YES];
    self.popoverController = nil;
    [button setTitle:@"Show Popover" forState:UIControlStateNormal];
} else {
    UIViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];

    self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:contentViewController] autorelease];
    [self.popoverController presentPopoverFromRect:button.frame 
                                            inView:self.view 
                          permittedArrowDirections:UIPopoverArrowDirectionDown
                                          animated:YES];
    [contentViewController release];
    [button setTitle:@"Hide Popover" forState:UIControlStateNormal];
}
}

是否有办法使此弹出窗口位于导航控制器栏上方?

希望有人知道如何解决这个问题,提前致谢。

I've sorta got a little problem. I'm trying to add a popoverview to my app but part of the popoverview get's hidden by my navigation controller bar. How can I make my popoverview overlay over top of the navcontrollerbar? Here's an image of the problem: http://img593.imageshack.us/img593/4056/viewn.jpg

Here's my code I'm working with:

- (IBAction)onButtonClick:(UIButton *)button {

if (self.popoverController) {
    [self.popoverController dismissPopoverAnimated:YES];
    self.popoverController = nil;
    [button setTitle:@"Show Popover" forState:UIControlStateNormal];
} else {
    UIViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];

    self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:contentViewController] autorelease];
    [self.popoverController presentPopoverFromRect:button.frame 
                                            inView:self.view 
                          permittedArrowDirections:UIPopoverArrowDirectionDown
                                          animated:YES];
    [contentViewController release];
    [button setTitle:@"Hide Popover" forState:UIControlStateNormal];
}
}

Is there anyway to make this popover above the navigation controller bar?

Hopefully someone knows how to fix this problem, Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜唯美灬不弃 2024-10-17 03:40:16

这可能与 WEPopoverController PresentPopoverFromRect:inView:permissedArrowDirections:animated: 的 inView 参数有关吗?您是否可以在视图层次结构中进一步呈现(例如在 self.view.window 中),而不是在 self.view 中呈现它?

Could this be related to the inView parameter to WEPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:? Instead of presenting it in self.view could you present further up in the view hierarchy (like in self.view.window)?

远山浅 2024-10-17 03:40:16

哦..我明白了..我改变了

- (void)presentPopoverFromRect:(CGRect)rect 
                    inView:(UIView *)theView 
  permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections 
                  animated:(BOOL)animated {

WEPopOverController 中 函数的行
来自[keyView addSubview:backgroundView];
[theView addSubview:backgroundView];

ohh..I got it..I changed line in function

- (void)presentPopoverFromRect:(CGRect)rect 
                    inView:(UIView *)theView 
  permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections 
                  animated:(BOOL)animated {

in WEPopOverController
from [keyView addSubview:backgroundView];
to [theView addSubview:backgroundView];

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文