iPad UIPopoverController 不会越过 UITextView 中的 inputView

发布于 2024-10-17 21:27:15 字数 891 浏览 5 评论 0原文

我正在尝试设置一个弹出窗口来指向视图中的 UIButton,该视图用作 UITextView 的“inputView”。我可以让一切正常工作,并且正确的数据将进入 UIPopoverController。但它表现出的行为不是我所期望的。这就是我所拥有的。以下方法编写在 UIView 子类中,该子类是 UITextView 的 inputView,也是按钮所在的视图。

- (IBAction)buttonTouchDown:(id)sender {
    UIButton *button = (UIButton *)sender;
    MyPopoverContentController *controller = [[MyPopoverContentController alloc] initWithNibName:@"MyNib" bundle:nil];
    [controller setContentSizeForViewInPopover:CGSize(320.0, 304.0)];
    self.popupController = [[UIPopupController all] initWithContentViewController:controller];
    [self.popupController presentPopoverFromRect:[button frame] inView:self permittedArrowDirectoions:UIPopoverArrowDirectionDown animated:YES];
}

现在,我希望弹出窗口漂浮在 inputView 上,并且指针将触摸我放置在视图中的按钮。但事实并非如此。在“X”原点中,弹出点是正确的。但是,当 UIView 作为输入视图时,它不允许弹出框在 inputView 上向下移动到 UIButton。我是否忽略了什么?

感谢您的帮助, 抢

I am trying to set up a popover to point to a UIButton in a view that is used as a "inputView" to a UITextView. I can get everything to work and the correct data is going into the UIPopoverController. But it is exhibiting a behavior that is not what I expected. So here is what I have. The following method is written in a UIView subclass that is the inputView of the UITextView and is also the view in which the button resides.

- (IBAction)buttonTouchDown:(id)sender {
    UIButton *button = (UIButton *)sender;
    MyPopoverContentController *controller = [[MyPopoverContentController alloc] initWithNibName:@"MyNib" bundle:nil];
    [controller setContentSizeForViewInPopover:CGSize(320.0, 304.0)];
    self.popupController = [[UIPopupController all] initWithContentViewController:controller];
    [self.popupController presentPopoverFromRect:[button frame] inView:self permittedArrowDirectoions:UIPopoverArrowDirectionDown animated:YES];
}

Now, I would expect the popover to float over the inputView and the pointer would touch the button I've placed into the view. But it does not. In the 'X' origin the popover point is correct. But it appears the UIView when acting as a input view it won't allow the popover to move down over the inputView to the UIButton. Am I overlooking something?

Thanks for any help,
Rob

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

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

发布评论

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

评论(2

愚人国度 2024-10-24 21:27:15

自从我访问这个问题以来已经有一段时间了。我把这个问题提交给苹果公司,这是一个错误。他们正在努力。

It's been a while since I visited this question. I turned this in to Apple and it is a bug. They are working on it.

烦人精 2024-10-24 21:27:15

尝试:

[self.popupController presentPopoverFromRect:button.bounds inView:button permittedArrowDirectoions:UIPopoverArrowDirectionDown animated:YES];

Try:

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