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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:00:36+00:00 2026-05-11T14:00:36+00:00

I have a UIViewController subclass that accesses self.navigationController in viewDidLoad:. Depending on where it

  • 0

I have a UIViewController subclass that accesses self.navigationController in viewDidLoad:. Depending on where it is in the view stack, I will either get the navigationController or I will get nil.

If my stack is ‘RootViewController -> MyViewController’, I get a valid pointer.

If my stack is ‘RootViewController -> AnotherViewController -> MyViewController’, I get nil.

In both cases, MyViewController is being pushed onto the stack with:

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

This has me stuck, because I need to be able to push another ViewController on the stack above MyViewController, which works fine in the first case but obviously fails on the second.

  • 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. 2026-05-11T14:00:37+00:00Added an answer on May 11, 2026 at 2:00 pm

    from everything I can see the UIViewController’s self.navigationController is designed to always return the appropriate UINavigationController as long as the UIViewController exists within a UINavigationController’s stack. This is probably one of those cases that I seem to run into myself more often than I’d like where a simple coding error is masquerading as something much more complex. In these cases I usually have good luck setting up an entirely new Xcode project with the minimal code needed to reproduce the issue and more times than not in that process I find a fix for something I overlooked that can then be easily applied in the main project. I’m sorry I can’t offer more specifics but what you are describing seems to go against the design of the Cocoa Touch framework and if you can still reproduce it in a minimal Xcode project written in strict accordance with the documentation it may be a good idea to file a bug report with Apple. Hopefully though you will just find something simple you overlooked and be kicking yourself in a few minutes =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 262k
  • Answers 262k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want to design a hardware simulation language, start… May 13, 2026 at 11:53 am
  • Editorial Team
    Editorial Team added an answer This will depend on your use case, but in the… May 13, 2026 at 11:53 am
  • Editorial Team
    Editorial Team added an answer It depends on what kind of software methodology you want… May 13, 2026 at 11:53 am

Related Questions

I have a UIViewController subclass that I am trying to have handle the shake
I am working on an iPhone app and am getting (null) references to IBOutlet
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)
I have a UIViewController subclass to control a UIView that I want to add

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.