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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:05:44+00:00 2026-05-25T20:05:44+00:00

OK, I have a RootViewController.m and defined a method in there: -(void)doSomethingParent { NSLog(@Parent

  • 0

OK, I have a RootViewController.m and defined a method in there:

-(void)doSomethingParent
{
    NSLog(@"Parent is doing something after child has asked");
}

I then added a childViewController.view like so:

if (self.child == nil) {

    ChildViewController *cvc = [[ChildViewController alloc]
                                initWithNibName:nil bundle:nil];
    self.child = cvc;
    [cvc release];

}    
[self.view insertSubview: child.view atIndex:0];

Now, I thought it would be very useful indeed if I could call my doSomethingParent method from the child. So I thought I would do it like this:

 @implementation ChildViewController
@class RootViewController;


- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    [super doSomethingParent];

}

But xCode tells me that “-doSomethingParent” not found… but I put @class in there?! Shouldn’t it find it? I don’t want to import the whole thing as I thought @class would be sufficient to let the child know that the parent has a method called doSomethingParent…

I’d be very grateful for any suggestions. Thanks in advance!

  • 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-25T20:05:44+00:00Added an answer on May 25, 2026 at 8:05 pm

    Set rootViewController object as the delegate of an object of childViewController type. And use that delegate from ChildViewController to pass messages to RootViewController.

    Inside RootViewController, when you create your ChildViewController object do:

    childViewController.delegate = self;
    

    And in ChildViewController, when you want to pass a message then pass it to RootViewController as:

    [delegate doSomething];
    

    In your ChildViewController.h interface, declare an ivar:

    id delegate;
    

    Then use @property (in .h) and @synthesize (in .m) for getter and setter.

    Then do the above.

    • 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 a RootViewController that has some UITabBarController properties: @interface RootViewController : UIViewController<LoginViewDelegate, UITabBarControllerDelegate>
I have a subview, called DataViewController, and a parent viewcontroller, called RootViewController. Everytime is
I have a RootViewController that calls an AddQuoteViewController and there is a variable subject_id
I have a RootViewController class and a UserSettingsController class. I have defined the UITableView
I have a UITableViewController, which is RootViewController. It's XIB only has a table view.
I have a rootviewcontroller and a loginviewcontroller. As soon as my app has finished
I have a UIView and UIButton (declared in viewDidLoad: method of RootViewcontroller. ). UIView
I have this RootViewController creation method, i want receive int value but i don't
I currently have an authentication view controller defined as the rootViewController when the app

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.