Duaan
Duaan

Reputation: 609

Xib for different iOS devices/simulator?

I run the simulator, I go to Hardware and Device, it shows list of Devices

iOS Simulator > Hardware > Device


iPad
iPad (Retina)

iPhone
iPhone (Retina 3.5 inch)
iPhone (Retina 4 inch)

I want to make different XIBs for all these devices. But I want to know the way. as I see there are two options in Xib Attribute Inspector

Xib Attribute Inspector > Size

Freeform
Retina 3.5 Full Screen
Retina 4 Full Screen

Though there

iPhone/iPod Touch 320x480
iPhone/iPod Touch having retina display 640x960
iPhone/iPod touch 5th 640x1136
iPad with non retina display 768x1024
iPad With retina display 1536x2048
iPad mini 768x1024

` How should I handle Xibs for above given Devices shown in simulator and how it covers all the iOS devices?

Upvotes: 0

Views: 921

Answers (2)

Prince Kumar Sharma
Prince Kumar Sharma

Reputation: 12641

You can get right tutorial for autoresizing here.

Just keep only two xib's

1) For iPhone that should be of size 320x480(3.5) OR 320x568 (4.0)
2)For iPad that should be of size 768x1024.

Manage Images for iphone and ipad with the same name differentiating it with prefix before extension.

like

image.png for iphone [email protected] for iphone retina.

Change subViews autoresize as

enter image description here

Check your 3.5 and 4.0 view as

enter image description here

Upvotes: 2

BergQuester
BergQuester

Reputation: 6187

Create image.png and [email protected] in your project. When referencing the image, use image.png. The OS will automatically select the correct image for the display.

To handle iPhone 5 vs iPhone 4, use auto resize, also known as springs and struts. This is what was used to handle dynamic layouts before autolayout came along.

You should only need two xibs by using these methods, one for iPad and one for iPhone.

Upvotes: 1

Related Questions