iPhone 4 和 iPhone 3G/GS 中的 UITableViewCell

发布于 2024-09-08 20:58:31 字数 228 浏览 0 评论 0原文

我正在我的 iPhone 应用程序中创建一个自定义 UITableViewCell 类,但鉴于 iPhone 2G/3G/3GS 和 iPhone 4 具有不同的分辨率屏幕,我不清楚如何声明尺寸。

显然,当我以编程方式添加元素时,我将使用基于屏幕分辨率计算的坐标,但当我在界面生成器中时,它会在 3G 坐标(这是我拥有的设备类型)处为我绘制尺寸。

有谁知道如何处理这个问题?

非常感谢, 布雷特

I am creating a custom UITableViewCell class in my iPhone app, but I am unclear how to state the dimensions given that the iPhone 2G/3G/3GS and iPhone 4 have different resolution screens.

Clearly, when I programmatically add an element, I'll use calculated coordinates based on the screen resolution, but when I am in interface builder, it draws the dimensions in for me at 3G coordinates (which is the type of device I have).

Does anyone know how to deal with this?

Many thanks,
Brett

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南风几经秋 2024-09-15 20:58:31

您混淆了点和像素。 UIKit 中的所有内容都以点为单位,在所有 iPhone 上都是 320x480。在 iPhone 4 上,1 点 == 2 像素,从 [[UIScreen mainScreen] 比例] 可以看出

You're confusing points and pixels. Everything in UIKit deals in points, which on all iPhones is 320x480. On an iPhone 4 1 point == 2 pixels as can be seen from the [[UIScreen mainScreen] scale]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文