iPhone 4 笔尖尺寸
我想做一个仅适用于 iPhone 4 的应用程序,该应用程序使用 iAd AdBannerView。当我添加它时,它的固定大小为 320x50。这在更高分辨率下如何工作?
有人可以解释一下 iPhone4 与以前的设备相比的更高分辨率如何与 xib 文件中的 UIView 相关吗?我是否创建比标准 320x480 更高分辨率的 UIView?推荐的做法是什么?
I want to do an iPhone 4 only app that uses the iAd AdBannerView. When I add this it has a fixed size of 320x50. How does this work with the higher resolution?
Can someone explain how the higher resolution of the iPhone4 vs the previous devices work in relation to UIView's in xib files. Do I create the UIView with the higher resolution than the standard 320x480? whats the recommended practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 iPhone 开发人员来说,iPhone 4 显示屏的分辨率实际上仍然是 320x480 点。底层的 cocoa touch 实现以 640x960 的分辨率为您呈现控件。 iAds 横幅将在您不注意的情况下处理额外的分辨率。
只有当您有位图或正在处理 OpenGL 内容时,您才真正需要考虑额外的像素。
当您使用 UIImage (或其他一些)位图时,理想情况下底层图像应与设备的本机分辨率相匹配。因此,在尺寸为 150ptx150pt 的 UIImage 中显示在 3G 上的 150x150 图像将在 150 像素 x 150 像素中正确显示,但在视网膜显示屏上,它实际上会渲染为 300 x 300 像素,并且可能看起来有点模糊,就像 UIImage 那样在将图片渲染到显示器之前放大图片。
有两个选项可以显示最佳图像:
[UIImage imageNamed:]
将自动加载 @2x 图像文件(如果存在),使得此选项非常容易实现。To an iphone developer the resolution of the iphone 4 display is actually still 320x480 points. The underlying cocoa touch implementation renders the controls all in 640x960 for you. The iAds banner will handle the extra resolution with out you noticing.
The only times you really need to think about the extra pixels is when you have bitmaps, or you are dealing with the OpenGL stuff.
When ever you are using UIImage (or some other) bitmap the under lying image should in an ideal world match the native resolution of the device. Thus a 150x150 image displayed on a 3G in a UIImage measuring 150ptx150pt will display just right in 150 pixels by 150 pixels, but on the retina display it'll actually be rendered into 300 x 300 pixels and could look a little blurred as UIImage has had to scale the picture up before rendering it to the display.
There are two options to get the best images displayed:
[UIImage imageNamed:]
will automatically load a @2x image file if present making this option quite easy to implement.