如何在导航控制器栏上覆盖视图?
我有点小问题。我正在尝试向我的应用程序添加一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能与
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 inself.view
could you present further up in the view hierarchy (like inself.view.window
)?哦..我明白了..我改变了
WEPopOverController 中 函数的行
来自
[keyView addSubview:backgroundView];
到
[theView addSubview:backgroundView];
ohh..I got it..I changed line in function
in WEPopOverController
from
[keyView addSubview:backgroundView];
to
[theView addSubview:backgroundView];