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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:51:19+00:00 2026-05-17T14:51:19+00:00

I normally use UIViews to make my apps – but this one I am

  • 0

I normally use UIViews to make my apps – but this one I am using a navigationcontroller. I am pushing a view to the top where I want to add items to an array. However, I cannot access the main navigation controller methods etc. Here’s the set up

1) AppDelegate adds navigation controller

[window addSubview:navigationController.view];

2) In RootViewController I push a new UIView

AddNewViewController *addNewViewController = [[AddNewViewController alloc] init];
[self presentModalViewController: addNewViewController animated:YES];

3) From the AddNewViewController I then want to access the main RootViewController – but cannot seem to access anything. All the methods etc are declared as I’ve done it before (using UIViews). This code cannot find anything in the RootViewController.

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.navigationController myFunction];

I have myFunction in the RootViewController.h file. I have used this method before, but never with a navigation controller. I guess it’s something to do with hte stack – but I cannot find out what I’ve done wrong!

Help is much appreciated!!

* UPDATE *

I have now used

AddNewViewController *addNewViewController = [[AddNewViewController alloc] init];
[self.navigationController pushViewController:addNewViewController animated:YES];

to push the view controller. In my code, I am trying to access the tableview to reload it with the following code

[self.navigationController.mainTableView reloadData];   

but the mainTableView is not accessible. I have declared and sync’d it but still cannot see it. I also tried to loop through and use the element[0] of the stack (as below) but didn’t get anywhere with that either!

NSArray *controllers = [[NSArray alloc] initWithObjects:self.navigationController.viewControllers, nil];

UIViewController *tmpController = [[UIViewController alloc] init];
tmpController = [controllers objectAtIndex:0];
  • 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-17T14:51:20+00:00Added an answer on May 17, 2026 at 2:51 pm

    First of all,

    [self presentModalViewController: addNewViewController animated:YES];
    

    does something different than

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

    The names of those methods should speak for themselves.


    And appDelegate.navigationController is not your rootViewController. It is the UINavigationController. You can get an NSArray of viewControllers attached to the navigationcontroller with self.navigationController.viewControllers. Item at index 0 should be your rootViewController.

    If you push the viewController on the navigationControllers stack there is no need to use the appdelegate. You can access the navigationController with self.navigationController.

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

Sidebar

Related Questions

I have this code that where I would normally use one line: if (tableView
I normally use ; to combine more than one command in a line, but
Web services on Heroku normally use the PORT environment variable, but I want to
I normally use gVim for editing, but I sometimes use vim when remotely connecting
I have identified the query constructs my users normally use. Would it make sense
I want to detect when my touchpad is clicked! I normally use a usb
Normally you use Form.Visible to check if Window is visible at all. But sometimes
I normally use this function to sanitize my form inputs before storing them into
In MVC2 template, I normally use this.ViewData.TemplateInfo.GetFullHtmlFieldId(fieldName) to generate the id field of an
I was wondering, I normally use std::string for my code, but when you are

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.