像在 Finder 中一样获取大型系统预览图像
因此,我正在开发一个显示有关当前计算机的一些信息的应用程序,我希望它与 Finder 非常相似。当您在 Finder 中的计算机上获取信息时,会出现一个带有计算机大图标的预览部分。我希望能够在我的代码中获得这些。例如,我有 2010 年中的 MacBook。做了一些搜索,结果发现图标存在于 /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/com.apple.macbook-unibody- Plastic.icns
我能够获取系统模型,我想 Finder 可以做到这一点,并且有某种映射将系统模型映射到正确的图像。有谁知道这种映射位于哪里,或者我如何复制这种效果?
So, I am working on an app that displays some info about the current computer, and I want it to be quite Finder-like. When you do Get Info on your computer in Finder, there is a preview section with a large icon of your computer. I want to be able to get these in my code. For example, I have the Mid-2010 MacBook. Doing a bit of searching, it turned out that icon is present in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/com.apple.macbook-unibody-plastic.icns
I am able to get the system model, and I suppose Finder does that and has some sort of mapping to map the system model to the correct image. Does anyone know where this sort of mapping is located, or how I could replicate this effect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
非常简单:
生成的图像有多种尺寸(
NSImageRep
)。根据您绘制的位置,应自动选择正确的尺寸。要访问特定尺寸(例如 512x512)版本,您可以执行以下操作:Very easy:
The resulting image has multiple sizes (
NSImageRep
s). Depending on where you draw it, the right size should be chosen automatically. To access a specific size (like the 512x512) version, you could do something like: