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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:19:44+00:00 2026-05-23T15:19:44+00:00

Hey everyone :) I’m having a small issue and i’d love to hear from

  • 0

Hey everyone 🙂 I’m having a small issue and i’d love to hear from your experience how would you deal with this.

My main screen is a login screen, and after a successful login I’m initializing a new view and switching to it in the following way i found here on SO:

    // Switch views 
    [txtUser resignFirstResponder];
    [txtPass resignFirstResponder];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[self view] cache:YES];
    [UIView setAnimationDuration:0.6];

    UIViewController *homeView = [[[UIViewController alloc] initWithNibName:@"HomeView" bundle:nil] autorelease];
    [self.view insertSubview:homeView.view atIndex:0];

    [UIView commitAnimations];

After login i wan’t to switch a view when the device rotates, but “willRotateToInterfaceOrientation” doesn’t catch anything inside my sub view, it only catches it if i put it in the parent.

So i was thinking about three options

  • Find a way to catch this rotation event inside the sub view
  • After login, switch views completely instead of just adding it as a sub view (so it would be a parent by itself?) – i dont know if its possible and if is im not sure how to do it , but i’d love to hear your experience.
  • Find some way to go into this rotated view from the parent (which is not a really good option i think)

I’m sorry if this is a little scrambled, hope you can understand and if not i’d love to elaborate and add more needed info , if any is needed 🙂

Thanks in advance,
Shai.

Edit:
I’ve added the navigation controller like @Ahmed suggested and pushed the new view but i’m getting an empty gray view instead of my HomeView.xib, any ideas on this perhaps?

On AppDelegate.h

<– language: lang-cpp –>

@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

On AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window.rootViewController = self.viewController;

// Initialize navigation controller
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:self.window.rootViewController];
self.navigationController = aNavigationController;
[aNavigationController release];
[_window addSubview:[_viewController view]];

[self.window makeKeyAndVisible];
return YES;
}

And then , after a successful login i tried

// Switch views 

    [txtUser resignFirstResponder];
    [txtPass resignFirstResponder];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[self view] cache:YES];
    [UIView setAnimationDuration:0.6];

    UIViewController *homeView = [[[UIViewController alloc] initWithNibName:@"HomeView" bundle:nil] autorelease];
    [self.navigationController pushViewController:homeView animated:YES];
    [self dismissModalViewControllerAnimated:YES];

    [UIView commitAnimations];

But i’m getting an empty gray view (like a new one) instead of my HomeView… any idea how could that happen? …

Thanks again you guys are lifesavers!

  • 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-23T15:19:44+00:00Added an answer on May 23, 2026 at 3:19 pm

    You should navigate to your another view instead of adding it as subView.

    [self.navigationController pushViewController:homeView animated:YES];  
    

    but for that you need to have instance of navigationController in your app. Or you should start with a navigation based template if you ain’t using one. You’re just adding your homeViewController’s View on your login view so only the view getting added and homeViewController will not get any event such as orientation change.

    Edit:

     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // Override point for customization after application launch.
    
    YourRootViewController *rootViewController = [[YourRootViewController alloc] init];
    
    UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    self.viewController = aNavigationController;
    [aNavigationController release];
    [_window addSubview:[_viewController view]];
    
       // self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey Everyone, Sorry to bother you with this, but I'm having an issue with
Hey everyone I am a newbie and would love some help. I got the
Hey everyone, this is #23 from John Resig Advanced JavaScript http://ejohn.org/apps/learn/#23 , called What
Hey everyone I am having a little problem with my jQuery I am trying
Hey everyone, I'm back and looking forward to more of your brilliance. I have
Hey everyone. I am having some issues on my end and hopefully it's just
Hey everyone, I was wondering how would I start programming an interface to trading
Hey everyone, running into a bit of an issue, I have created all my
Hey everyone I'm currently extremely frustrated and can not figure this out have looked
Hey everyone, I have a database result that returns from a method. I need

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.