iPhone中的像素和点数是多少? [英] What is pixel and points in iPhone?

查看:374
本文介绍了iPhone中的像素和点数是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自UIImage参考,

from UIImage reference,


尺寸

size

图像的尺寸,考虑到方向。
(只读)

The dimensions of the image, taking orientation into account. (read-only)



@property(nonatomic, readonly) CGSize size




讨论

Discussion

在iOS 4.0及更高版本中,此值反映图像的逻辑大小,并以磅为单位进行测量。在iOS 3.x及更早版本中,此值
始终反映以像素为单位测量的图像尺寸。

In iOS 4.0 and later, this value reflects the logical size of the image and is measured in points. In iOS 3.x and earlier, this value always reflects the dimensions of the image measured in pixels.

什么是像素和点之间的差异?

What's the difference between pixel and points?

推荐答案

iOS上的像素是设备的完整分辨率,这意味着如果我有图像这是100x100像素的长度,然后手机将在标准的非视网膜设备上渲染100x100像素。但是,由于较新的iPhone具有四倍的像素密度,因此相同的图像将以100x100像素呈现,但看起来只有一半大小。很久以前,iOS工程师在介绍Core Graphics的点系统时解决了这个问题(在使用Quartz的OS X中)。点是在非视网膜设备上相当于1x1像素的标准长度,在视网膜设备上相当于2x2像素。这样,您的100x100图像将在视网膜设备上呈现两倍大小,并基本上标准化用户看到的内容。

A pixel on iOS is the full resolution of the device, which means if I have an image that is 100x100 pixels in length, then the phone will render it 100x100 pixels on a standard non-retina device. However, because newer iPhones have a quadrupled pixel density, that same image will render at 100x100 pixels, but look half that size. The iOS engineers solved this a long time ago (way back in OS X with Quartz) when they introduced Core Graphics' point system. A point is a standard length equivalent to 1x1 pixels on a non-retina device, and 2x2 pixels on a retina device. That way, your 100x100 image will render twice the size on a retina device and basically normalize what the user sees.

它还在iOS设备上提供了标准的测量系统,因为无论像素密度如何,iPhone屏幕上总是有320x480点和768x1024点。 iPad屏幕。*

It also provides a standard system of measurement on iOS devices because no matter how the pixel density chanes, there have always been 320x480 points on an iPhone screen and 768x1024 points on an iPad screen.*

但与此同时,考虑到视网膜设备至少在iOS 4中引入,你基本上可以忽略文档,我不知道有太多人在新的iPhone上运行iOS 3。但是如果出现这种情况,你的UIImage需要在视网膜iPhone上以像素尺寸的两倍进行渲染,以弥补像素密度差异。

But at the same time, you can basically disregard the documentation considering that retina devices were introduced with iOS 4 at a minimum, and I don't know of too many people still running iOS 3 on a newer iPhone. But if such a case arises, your UIImage would need to be rendered at exactly twice its dimensions in pixels on a retina iPhone to make up for the pixel density difference.

< sub> *从iPhone 5开始,iPhone的尺寸现在不再标准化了。请使用适当的API来检索屏幕的尺寸或使用布局约束。

这篇关于iPhone中的像素和点数是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆