Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
662 views
in Technique[技术] by (71.8m points)

objective c - Specify images for iPad in Xcode like @2x for iPhone 4

I have upgraded my current target to iPad and made a universal app and the time for adjusting my iphone app to ipad would decrease significantly if there is an answer for this question.

By this time everybody know that if you have a image called "football.png" and want support for Retina Display you should double the size of the image and call it "[email protected]".

My question is if there is something for iPad like *football@iPad_which_is_another_size.png*?

If there isn't a way to do this, do I have to connect every image to an IBOutlet and set the frame programmatically?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In iOS 4.0 and later, it is possible to mark individual resource files as usable only on a specific type of device To associate a resource file with a particular device, you add a custom modifier string to its filename. The inclusion of this modifier string yields filenames with the following format:

 <basename><device>.<filename_extension>

To load the iPad specific resources you should use ~ipad. Example: create the image named AwesomeImage~ipad.png and load with [UIImage imageNamed:@"AwesomeImage.png"] like you do for retina display image.

For more information: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html At "iOS Supports Device-Specific Resources" section.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...