【问题标题】:Popover does not open over button弹出框无法打开按钮
【发布时间】:2011-02-22 17:48:07
【问题描述】:

布局...

我有一个 UIToolbar 加载一个带有多个按钮的视图。其中一个按钮,在 onpress 上应该会显示一个弹出窗口。

确实如此。但是,弹出窗口似乎在 0,0 时打开。

-(IBAction)FilterButtonPressed:(id)sender
{
if (_FilterViewController == nil) {
    self.FilterViewController = [[[FilterViewController alloc] initWithStyle:UITableViewStylePlain]  autorelease]; 
    _FilterViewController.filterViewDelegate = self;
    self.FilterViewPopover = [[UIPopoverController alloc] initWithContentViewController:_FilterViewController];

}
NSLog(@"Button...: %@",NSStringFromCGRect(self.FilterButton.frame));
[self.FilterViewPopover presentPopoverFromRect:self.FilterButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

NSLog 内容如下:

Button...: {{0, -4.38184}, {0, 4.76182e-39}}

这……太奇怪了……

关于为什么 FilterButton 不知道它在哪里的任何建议?

【问题讨论】:

    标签: iphone objective-c ipad uibutton uipopovercontroller


    【解决方案1】:

    关于为什么 FilterButton 不知道它在哪里的任何建议?

    看起来它未初始化/未正确初始化。您的所有网点都设置正确吗?每当“我的 xyz 对象行为不正常”发生时,检查您的网点通常是首要任务(请注意,该操作可以从按钮连接,但您的班级按钮的链接可能不是。尝试打印从“发送者”转换为“UIButton *”的状态。

    【讨论】:

    • 就是这样......它没有正确连接......该死。我一直在搞砸这个 /way/ 很长时间了。不过,记下了。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    • 1970-01-01
    相关资源
    最近更新 更多