In Interface Builder all coordinates are expressed in terms of a non-Retina device, and scaled on Retina devices. So running a XIB on non-Retina and Retina "just works". The same holds true for doing it in code (generally).
I'll give you an example. One of the projects I'm working on right now is a universal app that runs on iPhone, iPhone Retina, iPad, and iPad Retina. I am using only 3 sets of images and two XIB's to cover all devices. On the iPhone, I use the iPhoneFoo.xib, which is designed with Yada.png images. When the application is run on an iPhone Retina, the Yada@2x.pngimages are used in places of the Yada.png images automatically. All coordinates scale automatically. It just works. On the iPad, I use the iPadFoo.xib, which is designed with Yada@2x.pngimages. I simply use the iPhone's @2x image set as the default set on the iPad for non-Retina devices. When the application is run on an iPad Retina, the Yada@2...@2x.png images are used in places of the Yada@2x.pngimages automatically. All coordinates scale automatically. It just works. This has saved me a bunch of work, and a bunch of binary app space. I'm pretty pleased with how iOS works in this department. On Mon, Mar 19, 2012 at 2:04 PM, Alex Zavatone <z...@mac.com> wrote: > Well, let's put it this way; there are other things that need to be > cleaned up - like 900 lines of code that are called on viewWillAppear in > one class, 8 printed pages of warnings as well as a mix of XML, JSON and > comma delimited data structures that are fetched ala http on startup. > > Looking at all the other cases of how stuff is put together in this app, I > thought it safest to ask the people who have been doing this longer rather > than just proceed along thinking everything's just fine with this approach. > > Ya, I've actually gone in and modified the XML before to reposition > elements and wasn't sure I had the full grasp on how Xcode/Cocoa does it. > I thought it might be relative to a base coordinate system and then at > runtime, a 1.x multiplier might be applied to the plane that the controls > are drawn upon. But, I never had the time to rip through it all and get to > the bottom of it all. > > So, sweet. Thanks a bunch. > > > > On Mar 19, 2012, at 4:22 PM, Brian Lambert wrote: > > > Hi Alex, > > > > Regarding you having to "repair" code where "UI elements that have been > hardcoded in place with the approach of: Just define the CGRect and we're > all good." I think you're seeing things as being "gross" when they are not. > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com