iOS:创建无边框弹出窗口
iPad 上的日历应用程序如何实现无边框弹出框?我已经在 Mac OS 上用 NSWindow 做了几个,但在 iOS 上如何实现它?特别是圆形边框?我还希望能够在显示时移动它 有没有关于如何开始的指导?谢谢。
How is the calendar app on the iPad doing a borderless popover? I've done several on Mac OS with a NSWindow, but on iOS how would one implement it?, especially the rounded borders? I also want to be able to move it around while its being displayed
Any pointers on how to get started?, Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是一个自定义视图。我不相信它实际上是一个
UIPopoverController
。但我们无法真正确定,因为这是苹果尚未描述的实现细节。如果我的任务是重新创建它,我会构建一个自定义视图,而不是尝试修改
UIPopoverController
。It's probably a custom view. I don't believe it's actually a
UIPopoverController
. We can't really know for certain though because it's an implementation detail that Apple hasn't described.If I were tasked with recreating it, I would build a custom view rather than attempt to modify
UIPopoverController
.IIRC 弹出窗口控制器有一个名为“popoverStyle”的属性/ivar,它是一个整数;您可以半合法地使用它,执行诸如
[popoverController setValue:[NSNumber numberWithInt:1] forKey:@"popoverStyle"]
之类的操作。 IIRC 有一个白色背景的弹出窗口样式;我不确定 1px 轮廓到底来自哪里。即使您的应用被 Apple 接受(很可能是这样,因为它“只是”KVC),未来的操作系统版本中也很可能会出现问题。只有当您准备好在测试版操作系统上进行测试并及时修复最终版本的错误时才可以这样做,否则您的(付费?)客户最终可能会得到一个仅仅崩溃的应用程序。
IIRC the popover controller has a property/ivar called "popoverStyle" which is an integer; you can play around with it semi-legally doing something like
[popoverController setValue:[NSNumber numberWithInt:1] forKey:@"popoverStyle"]
. IIRC there's a popover style with a white background; I'm not sure exactly where the 1px outline comes from.This is highly likely to break in future OS versions even if your app is accepted by Apple (it probably is, since it's "just" KVC). Only do this if you're prepared to commit to testing on beta OSes and fixing bugs in time for the final release, otherwise your (paying?) customers might end up with an app that merely crashes.
如果您决定按照 Jonathan 的回答重新创建,请先查看 WEPopover,看看它是否满足您的需求。
https://github.com/werner77/WEPopover
If you decide to recreate as per Jonathan's answer, look into WEPopover before you do and see if it meets your needs.
https://github.com/werner77/WEPopover