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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:14:20+00:00 2026-05-25T03:14:20+00:00

I am creating an app which support all orientation. I am using navigationController here.

  • 0

I am creating an app which support all orientation.
I am using navigationController here.
for orientation i am using this code

- (void)willAnimateRotationToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {

if (interfaceOrientation == UIInterfaceOrientationPortrait 
    || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
    category1.frame = CGRectMake(54, 68, 190, 174);
    category2.frame = CGRectMake(291, 68, 190, 174);
    category3.frame = CGRectMake(525, 68, 190, 174);
    category4.frame = CGRectMake(54, 296, 190, 174);
    category5.frame = CGRectMake(291, 296, 190, 174);
    category6.frame = CGRectMake(525, 296, 190, 174);
    category7.frame = CGRectMake(54, 527, 190, 174);
    category8.frame = CGRectMake(291, 527, 190, 174);
    category9.frame = CGRectMake(525, 527, 190, 174);
    category10.frame = CGRectMake(291, 757, 190, 174);
    extra1.frame = CGRectMake(80, 781, 138, 125);
    extra2.frame = CGRectMake(551, 781, 138, 125);

}
else 
{
    category1.frame = CGRectMake(61, 50, 190, 174);
    category2.frame = CGRectMake(298, 50, 190, 174);
    category3.frame = CGRectMake(537, 50, 190, 174);
    category4.frame = CGRectMake(774, 50, 190, 174);
    category5.frame = CGRectMake(61, 278, 190, 174);
    category6.frame = CGRectMake(298, 278, 190, 174);
    category7.frame = CGRectMake(537, 278, 190, 174);
    category8.frame = CGRectMake(774, 278, 190, 174);
    category9.frame = CGRectMake(298, 509, 190, 174);
    category10.frame = CGRectMake(537, 509, 190, 174);
    extra1.frame = CGRectMake(80, 533, 120, 125);
    extra2.frame = CGRectMake(800, 533, 120, 125);

}

}

It works perfectly in this view. when i tab button it goes to secondviewcontroller where i am showing tableview.
But , if i go back to the firstview via navigation back button ,the orientation is not showing perfectly.
Above code is not working for navigation back button.

What should i do for this problem??
Any suggestion ??

Thank you in advance.

Edited:

I have removed my above function from firstview and copy the code to this function.

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {
    if (interfaceOrientation == UIInterfaceOrientationPortrait 
    || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
    category1.frame = CGRectMake(54, 68, 190, 174);
    category2.frame = CGRectMake(291, 68, 190, 174);
    category3.frame = CGRectMake(525, 68, 190, 174);
    category4.frame = CGRectMake(54, 296, 190, 174);
    category5.frame = CGRectMake(291, 296, 190, 174);
    category6.frame = CGRectMake(525, 296, 190, 174);
    category7.frame = CGRectMake(54, 527, 190, 174);
    category8.frame = CGRectMake(291, 527, 190, 174);
    category9.frame = CGRectMake(525, 527, 190, 174);
    category10.frame = CGRectMake(291, 757, 190, 174);
    extra1.frame = CGRectMake(80, 781, 138, 125);
    extra2.frame = CGRectMake(551, 781, 138, 125);

}
else 
{
    category1.frame = CGRectMake(61, 50, 190, 174);
    category2.frame = CGRectMake(298, 50, 190, 174);
    category3.frame = CGRectMake(537, 50, 190, 174);
    category4.frame = CGRectMake(774, 50, 190, 174);
    category5.frame = CGRectMake(61, 278, 190, 174);
    category6.frame = CGRectMake(298, 278, 190, 174);
    category7.frame = CGRectMake(537, 278, 190, 174);
    category8.frame = CGRectMake(774, 278, 190, 174);
    category9.frame = CGRectMake(298, 509, 190, 174);
    category10.frame = CGRectMake(537, 509, 190, 174);
    extra1.frame = CGRectMake(80, 533, 120, 125);
    extra2.frame = CGRectMake(800, 533, 120, 125);

}

    return YES;
 }

in my second view controller i have done

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {

    return YES;
 }

When i go back to the firstview by tapping navigation back button else condition(landscape mode) works fine but i don’t know why it is not working with if condition(Portraitmode).

  • 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-25T03:14:21+00:00Added an answer on May 25, 2026 at 3:14 am

    Write all this code in the following function.

     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
     {
            //set all the frames according to the current interface orientation
            return YES;
     }
    

    NEW EDIT :

    Write this method into your detailviewcontroller.m file

      - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
      {
            UIViewController *controller = [self.navigationController.viewControllers objectAtIndex:0];
            [controller shouldAutorotateToInterfaceOrientation:interfaceOrientation];
    
            return YES;
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am creating an app in which i want to take xmldata using webservices.
I am creating an app which will have a question in a UILabel and
I am creating a web app which uses jQuery to authenticate: $.ajax({ url: /session/create?format=json,
I am creating a system tray app which monitors mouse clicks in Windows. I
We are creating an app that uses modules which are dynamically loaded into the
I am creating an app that is having a UIWebView which contains an advert.
I am creating an iphone performance app in which I would like to know
I have a JavaScript widget which communicates with my Rails app by creating tags
I'm creating and app that will rely on a database, and I have all
I'm creating an install package using InnoSetup and installing SQL Server 2005 Express. Here's

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.