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

  • Home
  • SEARCH
  • 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 7622091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:21:54+00:00 2026-05-31T04:21:54+00:00

In essence what is the correct way of pushing a new view controller from

  • 0

In essence what is the correct way of pushing a new view controller from a sub view of a navigation controller.

The issue being subviews of the navigation view don’t inherit the self.navigationController (its nil)

The reason is I need separate controllers for the navigation bar view & the main view but both need to push new controllers.

I am willing to change this model if someone can tell me the correct way of doing this.

Also:

AppDelegate *del = (AppDelegate *)[UIApplication sharedApplication].delegate
[del.navigationController pushViewController:vc animated:YES];

Does not work as the delegates controller is nil.

  • 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-31T04:21:56+00:00Added an answer on May 31, 2026 at 4:21 am

    Create a following category on UIView.

    @interface UIView (GetUIViewController)
    - (UIViewController *)viewController;
    @end
    
    @implementation UIView (GetUIViewController)
    
    - (UIViewController *)viewController;
    {
        id nextResponder = [self nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return nextResponder;
        } else {
            return nil;
        }
    }
    @end
    

    Now get the SuperView from the subView.

    mySuperView = [mySubView superview];
    

    Then call the method from category created.

    mySuperViewController = [mySuperView viewController];
    

    Now, using this viewController, you can access the navigationController.

    I have not tried the above code and approach, but I hope it should work.

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

Sidebar

Related Questions

I have 1 Parent Controller and 1 View Controller. I have successfully performed the
Ran into a bit of an issue with some jQuery code, but in essence,
So I'm having problems releasing some view controllers. In essence the dealloc for the
I often see very different implementations of the Model View Controller Pattern, and completely
I have a view that displays object information when the correct URL is provided
In essence I want to pick the best match of a prefix from the
What is the function that I should pass to 'traverse' (from the essence of
Essence: How can I auto-rollback my hibernate transaction in a JUnit Test run with
In essence: every time I clone items I lose the data() value for those
The essence of the problem is, given a class hierarchy like this: class A

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.