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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:15:35+00:00 2026-05-15T11:15:35+00:00

I have a view with a tableView and a mapView. In portrait mode, I

  • 0

I have a view with a tableView and a mapView. In portrait mode, I want the mapView to occupy the top 60% of the screen, and the table view, the bottom 40%. In landscape, I want the mapView to occupy 45% of the screen on the right, and the tableView 55% on the left.

Thus, I thought that something like this ought to work:

    -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
    {
     UIScreen* mainscr = [UIScreen mainScreen];
     CGSize screenSize = mainscr.currentMode.size;

 if(self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft 
    || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
 {
  tableview.frame = CGRectMake(0, 0 , (screenSize.height*.55), screenSize.width);
  mapView.frame = CGRectMake((screenSize.height*.55), 0, (screenSize.height*.45), screenSize.width);
 }
 else 
 {
  tableview.frame = CGRectMake(0, (screenSize.height*.6) ,screenSize.width, (screenSize.height*.4));
  mapView.frame = CGRectMake(0, 0,screenSize.width, (screenSize.height*.6));
 }

    }

This code works fine on the iphone simulator with version 4 of the OS, but when I try to run it on the iphone 4 simulator or the ipad simulator, the views are completely off (i can only see the about a quarter of the map in portrait and none of the table, and in landscape i can see only the table).

I dont understand why this is the case — since im simply scaling the views to match the screen size, shouldnt something like the above code work fine regardless of the resolution of the device? I was able to make a ‘fix’ by scaling using different values for the iphone, iphone 4, and ipad, but the numbers that I used were discovered by trial and error, and they dont appear to make much sense.

can someone please point me towards the correct method for handing these orientation changes for all devices? Thanks so much!

  • 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-15T11:15:36+00:00Added an answer on May 15, 2026 at 11:15 am

    I have done something similar to this. Here is how I would accomplish what you would like to do

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
        CGSize screenSize = self.view.bounds.size;
    
        [UIView beginAnimations:@"InterfaceRotations" context:nil];
        [UIView setAnimationBeginsFromCurrentState:YES];
        [UIView setAnimationDuration:duration];
    
        if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
            tableview.frame = CGRectMake(0, 0 , (screenSize.height*.55), screenSize.width);
            mapView.frame = CGRectMake((screenSize.height*.55), 0, (screenSize.height*.45), screenSize.width);
        } else {
            tableview.frame = CGRectMake(0, (screenSize.height*.6) ,screenSize.width, (screenSize.height*.4));
            mapView.frame = CGRectMake(0, 0,screenSize.width, (screenSize.height*.6));
        }
    
        [UIView commitAnimations];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grouped table view with textfields in the tableview. For the keyboard
I have a table view where I want a different image for each cell
In my iPhone application I have a table view. When user taps any row,
Here's my case: I have a table view showing contacts. Add button in the
I have a view that I want to add some custom drawing to. I
I have a View that can vary significantly, depending on the 'mode' a particular
I have a table view that's showing a list of bank transactions. When I
i have table view and when user click on any row then he should
I have a table view with 9 rows at minimum. The background colors of
I have a view that has a list of jobs in it, with data

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.