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

  • SEARCH
  • Home
  • 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 1058849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:05:05+00:00 2026-05-16T18:05:05+00:00

In my app all my controls are created in code. I have not used

  • 0

In my app all my controls are created in code. I have not used IB for controls. now i want to rotate the view to landscape mode. I know I have to use the shouldAutorotate method for this purpose.

But since I have not used IB, how can I resize the controls when they are in landscape mode? How can I position them correctly using code only?

  • 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-16T18:05:05+00:00Added an answer on May 16, 2026 at 6:05 pm

    In most cases you can get views to resize themselves appropriately just by setting their autoresizingMask property to some combination of:

    • UIViewAutoresizingFlexibleLeftMargin
    • UIViewAutoresizingFlexibleRightMargin
    • UIViewAutoresizingFlexibleTopMargin
    • UIViewAutoresizingFlexibleBottomMargin
    • UIViewAutoresizingFlexibleWidth
    • UIViewAutoresizingFlexibleHeight

    For example, let’s say you want a view’s width to increase when you rotate it to landscape, you want it to maintain the same margins relative to the top, left, and right sides of the screen, and you want its height to remain the same. This means that out of the six attributes above, only the width and bottom margin should be flexible. The other four attributes are fixed. So you would do:

    yourView.autoresizingMask = UIViewAutoResizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
    

    In those rare cases when you can’t get the views to behave appropriately using their autoresizingMask property, you can wrap them in a custom view and override that view’s layoutSubviews method. This method gets called when the view’s frame changes due to autorotation, so you can check [[UIApplication sharedApplication] statusBarOrientation] and update the frames of your subviews manually.

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

Sidebar

Related Questions

when I press the Maximize button on my WPF app, all the controls therein
Hey all - I have an app where I'm authenticating the user. They pass
All the examples that I can search online use the App.Config mode of specifying
We all know that modifying a .NET web application's web.config file restarts the app
I have a small app that has a Render thread. All this thread does
I've created a winform in c#, I have 3 controls on the pages and
we're developing a web app to cover all aspects of a printing company from
My app needs to build a buffer from all the selected cells on a
I write my app in VS 2008 and so use all the fanciful stuffs
I plan to be storing all my config settings in my application's app.config section

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.