Designing for iPhone 4's Retina Display

转自:http://globalmoxie.com/blog/designing-for-iphone4-retina-display.shtml


So, um, maybe you heard: there’s a new iPhone out. For my money (and I shelled out plenty for it), the phone’s best feature is the new “Retina display,” the eye-popping high-resolution screen. Everything they say about it is true: at 320 ppi, the pixels are just plain invisible. The crisp bright screen really looks as good as print, absolutely gorgeous.

But what soothes the eye also adds headaches for designers. For three years, the iPhone came in just one flavor of screen resolution: the 3.5-inch screen was always 320x480 pixels. The new phone doubles the resolution to 640x960 pixels. Suddenly, we’re all designing for two different screens. Fold in the iPad, and you’ve got three iOS screens to juggle. (Hey, it’s better than designing for Android phones, which will have around 60 different devices and form factors by year end, but still... device fragmentation has arrived in its own small way in iOS land.)

Apple’s done some nice work under the hood in iOS 4 to make this transition as easy as possible, but designers still have to take on some extra legwork. Here’s the gist.

iPhone 4 vs iPhone 3GS display

I’ll Give You Two Pixels for That Point

Starting in iOS 4, dimensions are measured in “points” instead of pixels. Conveniently enough, the iPhone screen is 320x480 points on both iPhone 4 and older models. Since that matches the pixel dimensions on older phones, existing apps look and work the same on those phones in iOS 4 as they did in earlier operating systems. There, one pixel is one point, a one-to-one match.

In other words, dimensions for all the various elements of iOS 4 remain the same, but their units have changed: you just substitute points where you used to say pixels. (Ah, the travails of the hard-working tech writer; the new phone was unveiled just two weeks after my new bookTapworthy went to press. Though the 640x960 screen was already a foregone conclusion, it wasn’t yet clear how iOS would handle the new resolution, so I had to treat the matter with benign neglect. Alas, Tapworthy refers to all of its dimensions in pixels. If you have the book, just squint a little and pretend it says “points” instead.)

On iPhone 4, a point is two pixels; draw a one-point line, and it shows up two pixels wide. So: just specify your measurements in points for all devices, and iOS automatically draws everything to the right proportion on the screen. Text and images remain the same physical size on both old and new phones. That goes for bitmap images in legacy apps, too; iOS 4 blows ‘em up, automatically pixel-doubling them to adapt to the new phone’s resolution.

Of course, pixel-doubled images don’t take advantage of the gloriously crisp display on the new phone. That’s where your extra legwork comes in: to add high-resolution images to your app, you have to include a second set of all your graphic files. For every image in your app, add a second version that’s twice the size, adding @2x to the name. For a low-resolution image named image.png, for example, you would add a second file named image@2x.png. The new image will be picked up automatically by iPhone 4. Everywhere your code requests image.png(or even just plain old image), image@2x.png will be used instead.

Really? Yep, Really

I know what you’re thinking: “Do I really have to make two versions of my images? If I make a single high-resolution set, won’t iOS 4 scale them down on older devices?” Sorry, no, not automatically. While iOS 4 goes seamlessly in the other direction (scaling up low-res images for iPhone 4), it doesn’t work the other way. By default, it scales all images so that one pixel equals one point. That’s a great solution for making sure that old apps work correctly on the new phone, but it doesn’t help you go the other way ‘round.

While you could add additional code to downsize each and every high-res image for older devices, that would a) be a hassle, b) reduce performance, and c) create resized images that don’t look as good as the original. It might be extra work to create two sets of images for both old and new devices, but that’s the right way to go.

In practice, that means Photoshop fans should learn to get comfortable with Illustrator or [insert preferred vector application]. By building your app graphics in vector format, you can export them in whatever size you like with limited muss or fuss. This almost certainly won’t be the last time we see a new iPhone screen resolution emerge, and you can be ready for the next time by prepping all your graphics in vector formats. (Some folks, including Sebastiaan de Withand Rusty Mitchell saw this coming a long time ago.)

There’s one exception to that: the app icon. Because of the wide variety of sizes and contexts in which your app icon appears, a pixel-perfect bitmap approach makes good sense. That’s particularly true for the tiniest versions, where the fabulous vector detail of your large icon will just scale down to mush. More on icon Photoshoppery in a sec. First, let’s get acquainted with the growing family of app icons that iOS requires for the various devices.

Boy Howdy, That’s a Lot of Icons

It used to be simple. You used to need just three icon sizes: a big 512px icon for the App Store, a 57px icon for the home screen, and a 29px icon for search results. Now, if you’re building a universal app for iPhone, iPhone 4, and iPad, you’ve gotta create 11 — eleven! — separate icons. And can you believe it: the mix even includes both 57x57 and 58x58 versions. Oh, the humanity. Here’s the rundown:

App Store Icon
  • 512x512 (scaled down to 175x175 for display in the store)
Application Icon
  • 114x114 (iPhone 4)
  • 57x57 (older iPhones)
  • 72x72 (iPad)
Spotlight Search Results and Settings Icon
  • 58x58 (iPhone 4)
  • 50x50 (Spotlight results for iPad)
  • 29x29 (settings for iPad and older iPhones)
Document Icon

This is a new icon type in iOS 4. It’s used if your app creates a custom document type. The iPad uses the document icon in two different sizes.

  • 320x320 (iPad)
  • 64x64 (iPad)
  • 44x58 (iPhone 4)
  • 22x29 (older iPhones)
Neven Mrgan to the Rescue
Neven Mrgan's Photoshop template

And finally, the promised icon Photoshoppery. The inimitable Neven Mrgan put together a handy Photoshop template to help make quick work of this app-icon assembly line. Highly recommended.

Meanwhile, Back on the Web

If you're designing mobile websites or web apps, you likewise need to do a tiny bit more work to show off your high-resolution prowess on iPhone 4. WaltPad has all the details on how to use CSS3 media queries to give iPhone 4 (and other high-res devices) their own special style sheets. Good stuff.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 设计线性和开关电源的控制回路是一项重要的工作,可以保证电源的性能和稳定性。线性和开关电源是常见的电源类型,其工作原理和性能要求略有不同。 线性电源的控制回路主要包括电压反馈回路和当前反馈回路。电压反馈回路通过测量输出电压,并经过稳压器和放大器进行反馈控制。当前反馈回路则测量输出电流,并通过电流传感器和比较器对电流进行反馈控制。这些回路可以调整电源的输出电压和电流,以维持所需的稳定状态。 开关电源的控制回路则更加复杂。开关电源通过开关器件的周期性开关操作来控制输出电压和电流。其控制回路一般包括脉冲宽度调制器(PWM)和反馈控制回路。PWM负责将输入信号转换为开关器件的开关信号,以控制输出电压和电流的波形。反馈控制回路通过测量输出电压和电流,并将其与参考信号进行比较,通过调整PWM的占空比来实现输出的稳定性。 在设计控制回路时,需要考虑电源的负载变化、输出纹波、响应时间等因素。同时,选择合适的控制器、传感器和滤波器等元件也是很重要的。通过模拟和仿真等手段,可以优化和调整控制回路的参数,以满足特定的设计要求。 总之,设计线性和开关电源的控制回路需要综合考虑电源的特性和要求,并选择合适的控制方法和元件,以实现稳定、高效的电源输出。 ### 回答2: 设计线性和开关电源的控制环路涉及电源系统的稳定性和反馈机制。电源控制环路的设计目标是在负载变化时保持输出电压的稳定性和精确性。 线性电源的控制环路通常包括一个稳压器,在输入电压和负载变化时调整输出电压以保持在设定范围内。其中最常见的稳压器是线性稳压器和开环控制的电源。 开关电源的控制环路更复杂。开关电源通常通过高频开关和磁性元件(例如变压器和电感器)来转换输入电压。控制环路中的关键组件包括比较器、误差放大器、PWM(脉宽调制)控制器和反馈网络。通过比较输出电压与设定值,误差放大器将误差信号放大并传递给PWM控制器。PWM控制器以一定的频率开关开关管,调整开关管的开关周期和占空比,以使输出电压保持在设定范围内。 在设计控制环路时,需要考虑几个因素。首先,必须选择恰当的控制架构,包括类型和配置。其次,需要确定合适的反馈机制,以确保输出电压的准确性和稳定性。并且,必须采取适当的补偿措施,以保证系统的稳态和动态响应。最后,需要进行模拟和实验验证,以确保控制环路的性能和可靠性。 综上所述,设计线性和开关电源的控制环路是一项复杂的任务,涉及到稳定性、反馈机制和精确性。正确设计和实施控制环路可以确保电源系统的性能和稳定性。 ### 回答3: 线性电源和开关电源是常用的电源类型,用于为电子设备提供稳定的电压和电流。设计控制回路对于这两种电源都非常重要。 对于线性电源,控制回路的设计旨在实现稳定的输出电压。线性电源基于传统的电压调节器原理,输入电压经过变压器降压后,通过功率晶体管进行调整,以实现所需的输出电压。控制回路可以监测输出电压,并在需要时调整功率晶体管的导通时间或频率,以保持输出电压的稳定性。这可以通过使用反馈电路来实现,其中输出电压与参考电压进行比较,并根据差异来调整控制元件。设计控制回路还需要考虑输入电压变化、负载变化等因素对输出电压的影响。 对于开关电源,控制回路的设计旨在实现高效率和稳定的输出。开关电源通过周期性地开关功率开关,将输入电压转换为高频脉冲信号,再经过滤波器和转换器,最后输出所需的稳定电压。控制回路可以监测输出电压和电流,并相应地调整开关时间和频率,以保持输出的稳定性和效率。这可以通过使用PWM(脉宽调制)技术来实现,其中输出电压与参考电压进行比较,并根据差异来调整开关元件的控制信号。设计控制回路还需要考虑输入电压范围、负载变化、开关频率等因素对输出稳定性和效率的影响。 总结起来,设计控制回路对于线性电源和开关电源都是至关重要的。通过使用适当的反馈电路和PWM技术,可以确保输出电压稳定、效率高,并满足电子设备的需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值