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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:14:20+00:00 2026-06-15T12:14:20+00:00

I am using a UINavigationController and pushing/popping UIViewControllers onto it. In some instances I

  • 0

I am using a UINavigationController and pushing/popping UIViewControllers onto it. In some instances I am attempting to pop to the root view controller and then push a view controller after a short delay (0.1f).

My push code for the Message View Controller is as follows. My app fires two notifications. The first to select a tab and the second to push the correct view controller onto the stack of that tab.

//user taps a button and the app needs to switch tab and push the correct viewController
//onto the tab. I have tried setting pop == NO to avoid a 'double pop' but I still get
//overlapped titles
-(IBAction)messages:(id)sender {
    NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSNumber numberWithInt:4], [NSNumber numberWithBool:YES] , nil] forKeys:[NSArray arrayWithObjects:@"tab",@"pop", nil]];
    [[NSNotificationCenter defaultCenter] postNotificationName:kAutoSelectTab object:dictionary]; 

    [[NSNotificationCenter defaultCenter] performSelector:@selector(postNotificationName:object:) withObject:kMessages afterDelay:0.1f];
}


//responds to the first notification
-(void)autoSelectTab:(NSNotification*)notification {

    NSDictionary* dictionary = (NSDictionary*)[notification object];

    int tab = [[dictionary objectForKey:@"tab"] intValue];
    BOOL pop = [[dictionary objectForKey:@"pop"] boolValue];

    [self.tabBarController setSelectedIndex:tab];

    UIViewController* vc = [[self.tabBarController childViewControllers] objectAtIndex:tab];
    PSLogDebug(@"Selecting tab:%@",[vc class]);
    [self tabBarController:self.tabBarController didSelectViewController:vc];

    if (pop == YES) {

        if ([vc isKindOfClass:[UINavigationController class]]) {
            [(UINavigationController*)vc popToRootViewControllerAnimated:YES];
        }
    }
}

//responds to the second notification
-(IBAction)messages:(id)sender {
    [self.navigationController popToRootViewControllerAnimated:NO];
    MessagesViewController* vc = [[MessagesViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
    [vc release];
}

Functionally the views appear to pop and push correctly BUT the titles do not pop and each new title is overlaid atop the old one.

I set the titles for each of the view controllers in viewDidLoad

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"More";
}

When I don’t attempt the pop to root followed by the delay followed by the push – the titles and views behave as expected with no overlapping occurring.

Example Images from screenshots

enter image description here
enter image description here
enter image description here

I’ve had a good dig around stack overflow but I can’t see any questions which describe the same issue as the one I am having.

Qn.1: Is there something fundamentally incorrect with the popToRoot, Delay, push View approach?
Qn.2: If anyone out there has seen this kind of behaviour before, how did you resolve it?

  • 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-06-15T12:14:21+00:00Added an answer on June 15, 2026 at 12:14 pm

    Increasing the delay from 0.1f to 0.5f fixed the problem

    Change

    [[NSNotificationCenter defaultCenter] performSelector:@selector(postNotificationName:object:) withObject:kMessages afterDelay:0.1f];
    

    to

    [[NSNotificationCenter defaultCenter] performSelector:@selector(postNotificationName:object:) withObject:kMessages afterDelay:0.5f];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing an app using a UINavigationController. I set the root view controller
I developed a static library for iPhone using a UINavigationController & pushing some UIViewControllers.
I am using UINavigationController to push and pop a view. I used [[self navigationController]
I have an iPhone app using a UINavigationController. On the fourth controller of the
I'm trying to create a basic navigation app using UINavigationController as root container for
I am pushing and popping from one view to the other within my App.
I'm using a UINavigationController to manage my UIViewControllers hierarchy. For one of these UIViewController,
I am using a UINavigationController to handle the pushing and poping of viewControllers in
I'm using an UINavigationController: in my first view there is an UIButton which pushes
I have UINavigationController which needs to be displayed right after my root UINavigationController using

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.