问题标签 [retina-display]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
css - 采取了哪些方法来确保在所有移动设备中正确呈现移动 Web 图像?
使用 CSS 和两个不同的图像实例,我能够在两个不同的移动设备上实现我想看到的结果。对于使用屏幕宽度为 320 的设备,我将图像实现为 image1.png。对于最新的设备,例如 iPhone4(Retina 显示器),我将图像实现为 image1@2x.png。这需要一个 normal.css 样式表以及一个通过使用调用的 hirez.css 样式表
但是,这些新的 Amoled / Super Amoled 手机对这些 2x 图像的渲染效果很差;它使所有 2x 图像看起来像素化。
我试图弄清楚我做错了什么......每个文件名都有两组图像,并调用正确的 css 表......任何帮助将不胜感激。
iphone - UIButton image and retina display
I have some button with custom background image, and here is how I do this:
And I made four images, greyButton.png, greyButtonPressed.png and @2x versions to support retina.
But, on retina (iPhone simulator) I see ok my buttons, but on iPhone (3G) I think that is uses bigger images because my buttons are almost without rounded corners.
This is the right method for doing this?
iphone - iPhone - 以像素为单位获取视图的大小
我有一张相机拍摄的照片,我想将其调整为视图的确切大小。但是... iPhone 4 上的 bounds.size 没有考虑视网膜显示。
我想要一个可以给我视图的真实像素大小的代码,所以它可以在任何设备上工作,而无需测试/知道它运行的硬件类型。
你知道我该怎么做吗?
ios - iOS视网膜显示检测代码不起作用
我在检测 iOS 设备上的视网膜显示时遇到问题。我正在使用各种人推荐的以下代码:
问题是它对于部署目标 iOS 4 及更高版本编译得很好,但是当我为 iOS3.2 编译时,我在“scale = [s scale]”行出现“初始化中的类型不兼容”错误,因为我正在尝试为浮点数分配一个 id。我找不到任何相关的信息。由于其他人似乎都在使用这种方法,我一定在这里遗漏了一些非常明显的东西吗?顺便说一下,基本 SDK 版本是 4.3,带有 XCode 4。
这是我的 BaseSDK/部署目标设置:
更新:我已经解决了。基本上问题是一些 XCode 问题。为了解决其他一些问题,我必须卸载并重新安装 XCode。之后这种行为就消失了。
iphone - 视网膜显示中的 UITabBarItem 图像大小
我有一个 TabBarController 应用程序,它从 Web 获取所有图像,包括 tabBarController 的图标。我想要的是当设备具有视网膜显示时图像看起来不错。
这就是我正在做的事情:
- 根据屏幕比例缩小图像。
- 设置视图内容比例:imageView.contentsScale = [UIScreen mainScreen].scale;
它适用于带有 UIImageView 的标准图像,但是我无法弄清楚如何为 UITabBarItems 执行此操作,因为我无法访问框架或 contentScale。
有任何想法吗?
谢谢!
iphone - Save UIIView to Image, Store on Disk, Then Redisplay for Retina
I have a rather complicated workflow that is encountering issues on the retina display. I have a scrollview that can consist of up to 19 subviews. Each one of these subviews is composited of several different components (several UILabels, a UIImageView, and some UIButtons). There are multiple scrollviews on screen at any given time, with the potential of hundreds of total subviews. To save on overhead, I create each subview in memory, then flatten it to a UIImage, still in memory. From there I use the UIImage as the subview to display.
As another cost saving step, I decided to save these UIImages out to disk after they were composited, store the path in core data, and pull them off of disk in lieu of recreating them all the time. So, first I check on disk to see if an image for that article is present. If not, I create it, save it to disk, and display it on screen.
Here are the steps I am taking to accomplish this:
From this point, I use the UIImage in an UIImageView and it gets placed on screen. On first run, when being displayed from memory, it looks great. The second time around, I am pulling the same image from disk using the following code:
The problem is that on the times when the image is not generated, but is pulled from file, the text in the UILabels appears very blurry on the retina display. I can look at the generated images on disk by running this in the simulator and viewing them in the finder on the mac, and they appear crisp and are properly sized (2 times scale).
Is there an additional step I should be taking here?
ios - cocos2d, box2d and retina mode: give up, or try to get it to work?
I've been trying to get my box2d game to work in retina mode, and I'm running into a lot of irritating issues when running in higher-resolution mode.
cocos2d renders my graphics correctly in retina mode, but I'm finding the need for hack after hack to get box2d to work the same as in lower-resolution mode. For example, I'm finding I need to do something like this to get the debug draw shape size correct in retina mode:
That hack (adjusting all vertex points by CC_CONTENT_SCALE_FACTOR()
), of course inevitably leads to a density hack, to keep movement similar to lower-resolution mode:
And that leads to another adjustment hack when applying forces:
Keep in mind, I'm drawing in debug mode by scaling my debug draw calls, like so:
What is it that I'm fundamentally misunderstanding about getting box2d to work with retina mode? I'm using Steffen Itterheim's suggested Box2DHelper class in place of PTM_RATIO
, but that just doesn't seem to be enough. Any ideas? I'm about to give up entirely on retina mode for my game at this point.
php - 使用 PHP 和/或 JavaScript 进行 iPhone4 视网膜显示检测
我正在创建一个检测脚本,当用户到达我的站点时,它会嗅出任何带有视网膜显示器(或类似设备)的设备(目前只有 iPhone4)。因为分辨率更高,我需要推送更高分辨率的图像/图形。我能找到的唯一解决方案(使用 PHP 和 JavaScript)是检测devicePixelRatio
并设置一个 cookie。这是我正在使用的代码:
有没有人遇到过更好的方法或者有任何改进这个脚本的建议。这个脚本确实有效,只是感觉很脏。
ios - 具有默认样式的 UITableViewCell 的首选图像尺寸
UITableViewCell 缩略图的首选图像尺寸是多少?我倾向于 48x48 的原始 iPhone/iPad 和 96x96 的 iPhone 4 的 Retina 显示屏。我在 iPhone 3G、iPhone 4 和原始 iPad 上进行了测试,它们看起来不错。
干杯!
objective-c - 帧缓冲区 320x480 缩放图像/2 = 帧缓冲区 640x960 不缩放图像?
我已经阅读了很多主题,但我很困惑。看起来:
我的应用程序准备了一个大小为 320x480 的帧缓冲区,而无需进行上述检查……并将其显示在整个屏幕上。我认为如果我加载一个 2x 图像并将其显示在屏幕上(按比例缩小/2),我与准备一个 640x960 的帧缓冲区而不是按比例缩小我的精灵是一样的。这是正确的吗?我希望如此...否则我将不得不重写许多代码!谢谢