简体   繁体   English

考虑到可显示的各种分辨率,如何为Cocoa mac应用设置UI组件的大小?

[英]How to size my UI components for a Cocoa mac app given the potential variety of resolutions it could be displayed on?

  1. Cocoa uses a drawing system (user coordinate space) measured in "points" which are resolution independent...sounds great 可可使用绘图系统(用户坐标空间),以“点”为单位进行测量,这些点与分辨率无关...听起来很棒

  2. While we need to be concerned with our app running in many resolutions, Cocoa is going to take care of that for us in (1) above...sounds too good to be true! 尽管我们需要关注在许多分辨率下运行的应用程序,但可可在上述(1)中将为我们解决这个问题……听起来太好了,难以置信!

  3. It does scale our controls as resolution changes...this is good. 它确实会随着分辨率的变化扩展我们的控件...这很好。

  4. BUT the screen size increases as my resolution increases...this is not good, I though we had a drawing canvas that was independent of the resolution! 但是屏幕尺寸会随着我的分辨率的增加而增加...这不好,尽管我有一个与分辨率无关的绘图画布!

  5. What if the controls shrink to silly small levels as the resolution increases - should I be concerned about this? 如果控件随着分辨率的提高而缩小到很小的水平怎么办-我应该对此加以关注吗?

To summarize: is their a "standard" resolution I should design for and then all automatic scaling by Apple will automatically look fine? 总结一下:它们是我应该设计的“标准”分辨率,然后Apple进行的所有自动缩放都会自动看起来不错吗?

[Confused while reading the Apple Progammer Guide on the topic of Drawing] [在阅读有关绘图主题的Apple Progammer Guide时感到困惑]

You do not need to be concerned about this. 您不必担心这一点。 The user is only allowed to select resolutions which make sense given the physical size of the display, so the standard controls will always be "large enough". 仅允许用户选择在给定显示器物理尺寸的情况下有意义的分辨率,因此标准控件将始终“足够大”。 You just need to test your app on Retina and non-Retina displays (and ideally both at the same time, with an external 1x monitor plugged on a 2x machine ; move your windows between the two screens and check that your images update accordingly). 您只需要在Retina和非Retina显示器上测试您的应用程序(理想情况下,同时在2x机器上插入外部1x显示器;同时在两个屏幕之间移动窗口并检查图像是否相应更新)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM