如何知道码头尺寸?
在我的应用程序中,我需要知道应用程序运行时的底座大小是多少(我不想修改底座,只知道它的大小)。 这是我到目前为止发现的:
没有直接的方式与dock交互
使用com.apple.dock.plist,我可以知道tilesize和数量持久性应用程序和持久性其他应用程序,因此我“可以”计算停靠区大小,但仅限于持久性元素。我想要的是我询问时的底座大小,并且可能还有其他已启动的应用程序未在 plist 中的持久应用程序中列出,因此我计算的大小是错误的。
有人遇到过同样的问题吗?我是否必须循环遍历每个正在运行的应用程序才能猜测它在扩展坞中是否有项目?还有其他更简单的方法来获取底座大小吗?
所有的想法都非常受欢迎。预先感谢您的回答、提示...
In my app, I need to know what the dock size is at the moment my app is running (I don't want to modify the dock, only know its size).
Here is what I found until now :
no direct way to interact with dock
using com.apple.dock.plist, I can know the tilesize and the number of persistent apps and persistent others so I "could" compute dock size but only for persistent elements. What I want is the dock size at the moment I ask it and there can be other launched apps which are not listed in persistent apps in the plist so my computed size is wrong.
Has anyone ever faced the same issue ? Do I have to loop through each running app in order to guess if it has an item in the dock ? Is there an other easier way to get the dock size ?
All ideas are very welcome. Thanks in advance for your answers, hints...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了 NSDockTile 另请查看 NSScreen 来计算停靠栏的大小。
Besides NSDockTile also have a look at NSScreen to compute the size of the dock.