我有点问题。我正在尝试向我的应用添加一个popoverview,但部分popoverview被我的导航控制器栏隐藏起来。如何将我的popoverview覆盖在navcontrollerbar的顶部?这是问题的图像: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];
}
}
无论如何都要在导航控制器栏上方设置此弹出窗口吗?
希望有人知道如何解决这个问题,提前谢谢。
答案 0 :(得分:8)
这可能与WEPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:
的inView参数有关吗?您可以在视图层次结构中进一步显示(而不是self.view
),而不是在self.view.window
中显示它吗?
答案 1 :(得分:0)
哦......我明白了......我在功能上改变了行
- (void)presentPopoverFromRect:(CGRect)rect
inView:(UIView *)theView
permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections
animated:(BOOL)animated {
WEPopOverController中的
来自[keyView addSubview:backgroundView];
到[theView addSubview:backgroundView];