Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3932058
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:24:54+00:00 2026-05-19T23:24:54+00:00

I’d like to convert my views to work for any orientation (especially since it

  • 0

I’d like to convert my views to work for any orientation (especially since it recommended for iPad). I’ve been using IB to lay things out, and am not sure how to best proceed.

What I would ideally like is to rotate the view in IB, redo the layout, and save both orientations to the same XIB so that the view automatically knows what to do when the orientation changes. This doesn’t seem possible.

I know I can rearrange the views in code when the orientation changes, but then there’s not much point in using IB, since one of its main advantages for me has been to separate out all that ugly layout code from my logic.

What do others do for this? Do they just design their views so that the UIViewAutoResizing flags can handle rotations appropriately? Do they have multiple views for each orientation and somehow switch these out smoothly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:24:54+00:00Added an answer on May 19, 2026 at 11:24 pm

    I found the information here (and elsewhere on StackOverFlow on this topic), and it got me to thinking about my previous answer. This just gets tedious if you have lots of top level objects.

    Then, it occurred to me that you could create a “helper” object, so I created a project to demonstrate the technique. Basically, the helper has an outlet for each object of interest in the view. The ViewController itself has two Helper objects (one for p, one for l) and you instantiate those in the NIB. On orientation changes, you switch the view controller’s helper pointer to the appropriate helper, then update self.view. Its really simple (this text is harder).

    So, how would you start? Well it helps if you know a priori that you will need two separate view. Once you know that, take the Helper template in the referenced project below, adapt it, add it to your NIB, and then connect the help to the appropriate objects in the portrait view. The View Controller itself just has a reference to the two helpers, and a “curHelper” pointer. The Helper ivars are public, so the View Controller can reference items like “curHelper->label1.text = … – the cost is a single pointer dereference (could just use properties too – your call).

    Also, you can directly connect IBActions from the objects in either view. So, lets walk through this:

    • create the NIB
    • create a Helper object, and instantiate one in the nib called Portrait
    • add all the IBOutlets to the Helper object, handle then in dealloc, viewWillUnload
    • put IBActions as normal in the View Controller
    • wire up the NIB – Helper->Portrait view outlets, actions to the View Controller
    • get it all working in Portrait
    • add a new Helper object, call it Landscape
    • dup the current portrait view, rotate it, and save it
    • wire up the landscape Helper’s outlets to the new landscape view (actions already set for you!)

    Obviously you need to from now on make duplicate changes, but in any dual nib scheme you would have to do that. In the above technique, all outlet names stay the same.

    The View Controller needs to send “viewDidUnload” to both helpers when it receives it, and to dealloc the Helpers (which then dealloc their outlets).

    NOTE: I just put this together to see how it looked. If you want to see the code and a really small demo, you can download it from public dot me dot com slash dhoerl, in the iPhone folder with name Helpers.zip. I’ll update this and this text if needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have some data like this: 1 2 3 4 5 9 2 6
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have text I am displaying in SIlverlight that is coming from a CMS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.