类似于 iCal 的 Cocoa 弹出窗口
当用户在我的 NSTableView
中选择一个单元格时,我想打开一个覆盖窗口(弹出窗口),类似于在 iCal 中选择事件。在 iCal 中选择事件会显示一个用于编辑事件的窗口,但可以通过平滑地动画打开窗口并添加指向基础日历中事件的箭头来实现。有谁知道这里用的是什么?这是一堆隐藏/自定义 API 还是可供公众使用?
I want to open an overlay window (pop up window) when a user selects a cell in my NSTableView
similar to selecting an event in iCal. Selecting the event in iCal shows a Window to edit the event, but does so by smoothly animating the window open and adding an arrow pointing to the even in the underlying calendar. Does anyone know what is being used here? Is this a bunch of hidden/custom APIs or is this available for public use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑器窗格似乎是一个带有自定义视图的自定义无边框透明窗口(该视图定义了形状,从而定义了它投射的阴影)。了解更多信息此处。您甚至可以使用 MAAttachedWindow。
关于动画,就像要求窗口的动画制作者为框架和 alpha 值设置动画(将它们组合在一起)一样简单。您可能希望首先将所有内容直接设置在其“开始位置”(即,当窗口位于屏幕外时,将其 alpha 设置为零,并将其框架设置为某个较小的版本,以便它像 iCal 一样“放大” ),然后将其放在屏幕上并启动分组动画:
分组结束后,动画将开始(异步),并且您的代码执行将继续。需要考虑的事情是首先将所有内容“暂存”(包括确保窗口的子视图已提前更新,这样它们就不会在动画中间发生变化......除非您希望它们这样做)。
因此,您需要了解的两种不同的技术是自定义窗口和基本的 Cocoa 动画。
The editor pane appears to be a custom borderless, transparent window with a custom view (the view defines the shape and therefore the shadow it casts). Learn more here. You might even use MAAttachedWindow.
Regarding animation, it's as simple as asking the window's animator to animate the frame and the alpha value (grouping them together). You'll probably want to set everything up directly in its "start position" first (ie, while the window is off-screen, set its alpha to zero, and its frame to some smaller version so it "zooms in" a la iCal), then put it on screen and start the grouped animation:
Once the grouping is ended, the animation will begin (asynchronously) and your code execution will continue. Something to think about is getting everything "staged" first (including making sure the subviews of your window are already updated beforehand, so they don't change in the middle of your animation ... unless you want them to).
So the two separate techniques you need to understand are a custom window and basic Cocoa animation.
如果您使用的是 OSX 10.7 及更高版本,
NSPopover
将完成您正在寻找的工作。If you're using OSX 10.7 and above,
NSPopover
will do the job you're looking for.您是在谈论甚至从 iCal 应用程序底部的列表中进行选择吗?
不确定你到底指的是什么,但有一个 api 用于在一个时间跨度内对转换进行动画处理。
看看其他 Apple 的应用程序,Apple 的开发人员使用其他任何人都可以使用的相同 API(我猜大部分是这样)。有很多东西可以定制,苹果会定制任何需要的东西,直到它从设计的角度来看是正确的......
Are you talking about selecting even from a list at the bottom of iCal app?
Not sure what exactly you are referring to but there is an api for animating transformations within a timespan.
Looking at other Apple's applications, Apple's developers utilize the same api available to anyone else (mostly I guess). There is lots of stuff that can be customized and Apple customizes whatever is required until it looks right from design point of view ...