• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Device/Resolution independent positioning of GUI items on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Device/Resolution independent positioning of GUI items on iOS


  • Subject: Re: Device/Resolution independent positioning of GUI items on iOS
  • From: Brian Lambert <email@hidden>
  • Date: Mon, 19 Mar 2012 14:20:26 -0700

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
email@hiddenages 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
email@hiddenages.  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@email@hidden images are used in places of the
email@hiddenages 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 <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Device/Resolution independent positioning of GUI items on iOS
      • From: Brian Lambert <email@hidden>
References: 
 >Device/Resolution independent positioning of GUI items on iOS (From: Alex Zavatone <email@hidden>)
 >Re: Device/Resolution independent positioning of GUI items on iOS (From: Brian Lambert <email@hidden>)
 >Re: Device/Resolution independent positioning of GUI items on iOS (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Device/Resolution independent positioning of GUI items on iOS
  • Next by Date: Re: Why so many public properties all up in my grizzle?
  • Previous by thread: Re: Device/Resolution independent positioning of GUI items on iOS
  • Next by thread: Re: Device/Resolution independent positioning of GUI items on iOS
  • Index(es):
    • Date
    • Thread