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 6220079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:53:43+00:00 2026-05-24T07:53:43+00:00

In ios, where’s the best place in a view controller to move your custom

  • 0

In ios, where’s the best place in a view controller to move your custom subviews around to handle rotations? (of course this is only for those where the autoresizingflags don’t help).

Here’s the following places i’ve tried, and the issues each has:

  • willAnimateRotationToInterfaceOrientation:duration

This works, and any subview frame changes you make are animated nicely as the device is rotated landscape<->portrait. However, if you’re in a tab controller, this doesn’t get called when another VC is visible. And so if you rotate, and switch back to this tab, it’ll have the wrong layout.

  • viewWillAppear

Doesn’t really help, because this gets called before the rotation takes effect, so when accessing self.view.frame you get the pre-rotation sizing, so you can’t know whether we’re going for landscape or portrait

  • viewDidAppear

This is better than viewWillAppear, however because it gets called after the view goes on screen, you see a flash of content in the wrong layout before it flicks across.

I just want to know where the proper place is to put my code that lays out my view controller’s subviews nicely to handle both layouts, animated nicely. THanks all

  • 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-24T07:53:44+00:00Added an answer on May 24, 2026 at 7:53 am

    I usually have my own layoutViewsForOrientation:(UIInterfaceOrientation) method which I call both from willAnimateRotationToInterfaceOrientation:duration (to get the nice animations you mention), and from my viewWillAppear: (with self.interfaceOrientation) to set up my view before it appears.

    So the answer is that the proper place to layout your view is whenever something changes and you’re not sure that it’s in the proper orientation, and you can use a layout function to keep your code clean.

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

Sidebar

Related Questions

With iOS 5 and storyboarding, what is the best way to present a view
I'm writing an iOS app with a table view inside a tab view. In
I'm working on an iOS app where I want to load one view if
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
(iOS) I have a UITableView as a root view (screen 1). when a cell
(iOS) I have a view that contains multiple textviews under static headings (see image
For iOS there are companies such as Flurry that give you analytics for your
I'm having another iOS related issue. This time relating to addSubView on a UIView.
On iOS (or any mobile), after a successful login, how should I handle login
iOS uses programmatic styling for tab style icon images. I was wondering if this

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.