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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:12:16+00:00 2026-05-28T19:12:16+00:00

I have a RootViewController that calls an AddQuoteViewController and there is a variable subject_id

  • 0

I have a RootViewController that calls an AddQuoteViewController and there is a variable “subject_id” that I set in the RootViewController that does not show up in AddQuoteViewController and I need help understanding why and how to fix it.

    Subject *sub = [self.tableDataSource objectAtIndex:indexPath.row];

    self.subject_id = sub.subject_id;

    [self addQuote_Clicked: sub];

…

- (void) addQuote_Clicked:(id)sender {

    if(aqvController == nil)
        aqvController = [[AddQuoteViewController alloc] initWithNibName:@"AddQuoteView" bundle:nil];

    if(addNavigationController == nil)
        addNavigationController = [[UINavigationController alloc] initWithRootViewController:aqvController];

    [self.navigationController presentModalViewController:addNavigationController animated:YES];
}

Then in my AddQuoteViewController I try to access this variable like this:

RootViewController *rv = [RootViewController alloc] ;

NSLog(@"rv.Subject_id = %d", rv.subject_id);

But get nothing. There must be a simple way to do this.

  • 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-28T19:12:17+00:00Added an answer on May 28, 2026 at 7:12 pm

    There are various ways of doing this, but a short answer – You can set a reference to the RootViewController as a property on your AddQuoteViewController

    i.e.

    in AddQuoteViewController.h

    RootViewController *rvc
    

    …

    @property (nonatomic,assign) RootViewController *rvc;
    

    and corresponding synthesize and release in your implementation class. (AddQuoteViewController.m)

    Then when you create your AddQuoteViewController inside your RootViewController, also set this property:

    - (void) addQuote_Clicked:(id)sender {
    
        if(aqvController == nil)
            aqvController = [[AddQuoteViewController alloc] initWithNibName:@"AddQuoteView" bundle:nil];
        aqvController.rvc = self;
    ... etc.
    

    Then you can access any property of the root view controller inside your AddQuoteViewController via this property:

    NSLog(@"rv.Subject_id = %d", self.rv.subject_id);
    

    As a side note there are a few things you are doing in your question that are a bit unusual, like trying to get a reference to an object by allocating a new one, and also creating a new navigation controller and presenting it as a modal view controller typically you would do one or the other (and wouldn’t need to create a new navigation controller). i.e. you would either create a view controller and present it modally, or you would create a view controller and push it onto your current navigation controller stack.

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

Sidebar

Related Questions

I have this button on the leftside of my UISplitViewController (RootViewController) that has a
I have UITableViewController as the RootViewController. I need to add rows to the table
I have a RootViewController that is a UIViewController with a UITableView. This RootViewController pushes
How can set self.navigationItem.backBarButtonItem of my RootViewController , so that the back button is
I have a navigation based iPhone app. Normally you start on the RootViewController, there
I have a RootViewController and a SubViewController. I traverse the views in either direction.
I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Lets say that I have 4 view controllers (call them FirstView,SecondView,ThirdView,FourthView) which are created
I have a class that communicates with a server (let's call it 'Downloader'). Sometimes,

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.