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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:23:04+00:00 2026-05-23T09:23:04+00:00

I am making app like whenever the device change it’s orientation mode it changes

  • 0

I am making app like whenever the device change it’s orientation mode it changes it’s view.
At first when the view is portrait it shows perfect SearchViewController, then when i rotate to landscape it push to new view MapView in landscape … now when i again change the view to portrait the map rotate to portrait… but it should be do to search view controller… and one more thing when i tapped detail disclosure button it should be go to back to search view controller… i think navigation controller not work in map view..

this is my code part of searchViewController

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {


    //return (interfaceOrientation == UIInterfaceOrientationPortrait);  
    if(interfaceOrientation == UIInterfaceOrientationPortrait|| inte rfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)  
    {  
    }  
    else {  
        MapView *mapView = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];  
        mapView.title = @"Map";  
        [self.navigationController pushViewController:mapView animated:YES];   
        return YES;  

    }  
    return YES;

}  

and this is my MapView code

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation   {  
    // Return YES for supported orientations  
    //  return (interfaceOrientation == UIInterfaceOrientationLandscapeRight|| UIInterfaceOrientationLandscapeLeft);  
    if(interfaceOrientation == UIInterfaceOrientationPortrait|| interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)  
    {  
        NSLog(@"hi Potrait");  
        [self.navigationController popViewControllerAnimated:NO];  
        return YES;  
    }  
    else {  
    }  
    return YES;  
}
  • 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-23T09:23:04+00:00Added an answer on May 23, 2026 at 9:23 am

    shouldAutorotateToInterfaceOrientation: is an incorrect place to implement any kind of navigation. You should do it in didRotateFromInterfaceOrientation: instead. Check the current interfaceOrientation and push or pop if necessary.

    In searchViewController,

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
        if ( UIInterfaceOrientationIsLandscape(self.interfaceOrientation) ) {
            MapView *mapView = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];  
            mapView.title = @"Map";  
            [self.navigationController pushViewController:mapView animated:YES]; 
        }
    }
    

    In MapView,

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
        if ( UIInterfaceOrientationIsPortrait(self.interfaceOrientation) ) {
            [self.navigationController popViewControllerAnimated:NO];
        }
    }
    

    And alter your shouldAutorotateToInterfaceOrientation: to

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return YES;
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an app for fun and would like to know how to implement
i've been making web app's and working with various server side language like php,
I am making a dynamic URL in my rails app like http://localhost:3000?#{something}=#{something1} How do
I am making an app for an author (Patrick Rothfuss) and I would like
I'm making a explorer like app to browse files stored on my computer. My
I am making an app where I would like the notification bar to be
I am making a Process-Viewer like app. in windows which displays all the processes
I am making an app a bit like a dictionary, where a user clicks
I have tried making a listview for a android app like this tutorial .
When developing a Grail app in IntelliJ there's a console view: Whenever I make

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.