MonoTouch 和 UIPopoverController

发布于 2024-09-19 04:49:29 字数 479 浏览 2 评论 0原文

我有一个 iPad 应用程序,其以下代码绑定到按钮的 (bMyDocuments) TouchDown 事件处理程序:

UIPopoverController uipoc = new UIPopoverController(new Pop2());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (bMyDocuments.Frame, v, UIPopoverArrowDirection.Up, true);

Pop2 是一个具有默认视图(白色背景,无 ui 元素)的空白 UIViewController。

此代码从按钮生成一个弹出窗口,并且大小正确。但是,该应用程序挂起时没有任何错误,并且在其外部单击时弹出窗口不会消失。

如何正确初始化 UIPopoverController?示例代码?

谢谢,

波姆

I have a iPad app with the following code tied to a button's (bMyDocuments) TouchDown event handler:

UIPopoverController uipoc = new UIPopoverController(new Pop2());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (bMyDocuments.Frame, v, UIPopoverArrowDirection.Up, true);

Pop2 is a blank UIViewController with the default view (white background, no ui elements).

This code produces a popover from the button, and the size is correct. However the app hangs without any errors, and popover won't disappear when clicking outside of it.

How can I initialize UIPopoverController correctly? Sample code?

thanks,

pom

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

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

发布评论

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

评论(1

2024-09-26 04:49:29

垃圾收集器很可能正在吞噬您的 UIPopoverController。尝试将 UIPopovercontroller 声明为类变量,而不是在 TouchDown 事件中声明,看看效果如何。

干杯,

克里斯NTR

Chances are that the garbage collector is eating up your UIPopoverController. Try declaring your UIPopovercontroller as a class variable instead of inside your TouchDown event and see how that goes.

Cheers,

ChrisNTR

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