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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:26:52+00:00 2026-06-17T16:26:52+00:00

So I have 3 views as follows: viewController >> viewController2 >> viewController3. In viewController3

  • 0

So I have 3 views as follows: viewController >> viewController2 >> viewController3.
In viewController3 I have created a Delegate Protocol. The protocol method is a simple method that prints out an NSLog.

When I call the delegates from ViewController3, only its parent (viewController2 ) responds not the (first) viewController. There are no errors.I think problem has got something to do with [v2 setDelegate:self]; in the viewController.m file.
Nevertheless,[self.v3 setDelegate:self]; works fine in ViewController2.m file.

Why does the (first) viewController delegate not respond ? Do delegates only work with its immediate child ??

> **ViewController.h**
   #import <UIKit/UIKit.h>
   #import "ViewController2.h"
   #import "ViewController2.h"
   @interface ViewController : UIViewController <PassData>{

    ViewController2 *v2;
   }
   @property (strong, nonatomic) ViewController2 *v2;

> Blockquote

    - (IBAction)button:(id)sender;
    @end

> **ViewController.M**

    #import "ViewController.h"

   @interface ViewController ()

   @end

   @implementation ViewController
   @synthesize v2;

    - (IBAction)button:(id)sender {

    v2 = [[ViewController2 alloc]initWithNibName:@"ViewController2" bundle:nil];
    [v2 setDelegate:self];
    [self.view addSubview:v2.view];
    }

    -(void)print: (BOOL)success;{

    if (success == YES) {
        NSLog(@"ViewController called");
    }

    }

    @end

> > ViewController2.h

   #import <UIKit/UIKit.h>
   #import "ViewController3.h"

    @interface ViewController2 : UIViewController <PassData> {

    ViewController3 *v3;

     }
     @property (strong, nonatomic)ViewController3 *v3;
     @property (retain) id delegate;

   - (IBAction)button:(id)sender;
     @end

   ViewController2.m

   #import "ViewController2.h"

    @interface ViewController2 ()

     @end

    @implementation ViewController2
   @synthesize v3,delegate;

     - (IBAction)button:(id)sender {

    v3 = [[ViewController3 alloc]initWithNibName:@"ViewController3" bundle:nil];
    [self.v3 setDelegate:self];
    [self.view addSubview:v3.view];

     }

    -(void)print: (BOOL)success;{

    if (success == YES) {
          NSLog(@"ViewController2 called");
    }
    }
     @end

> ViewController3.h

   #import <UIKit/UIKit.h>

    @protocol PassData <NSObject>

    @required

    -(void)print:(BOOL)success;

    @end

    @interface ViewController3 : UIViewController {

    id<PassData>  delegate;

     }

    @property (retain) id delegate;

   - (IBAction)callButton:(id)sender;

    @end

     ViewController3.m

    #import "ViewController3.h"

    @interface ViewController3 ()

    @end

    @implementation ViewController3
    @synthesize delegate;

    - (IBAction)callButton:(id)sender {

    // call all delegates
      [[self delegate]print:YES];

     }
    @end
  • 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-06-17T16:26:53+00:00Added an answer on June 17, 2026 at 4:26 pm

    v2 doesn’t have a method “print”, that’s a protocol method of v3 — you can’t chain delegate messages like this. If you want multiple controllers to respond to something in another controller, then you should use an NSNotification — any number of objects can register to receive a notification.

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

Sidebar

Related Questions

I have a ViewController that contains a UITableView in which the cells are created
I have a very simple method that allows me to specify the name of
I have 4 views that are controlled by 1 SherlockMapActivity. Currently I am switching
I am trying to perform a simple operation that i have done alot in
I have a simple UIWebView nested in a ViewController it is presented modally off
Within my main viewController I have two ivars declared as follows: UIPopoverController* __popoverController; HPSQuestionnaireEditorController*
I have an iPhone application that loads succesive views in a framework based on
I have a project that I created by using Xcode's Single View Application template.
I have defined a property in my viewcontroller as follows @interface QuestionAnswerViewController : UIViewController
I have a tab bar application and I want to display those views that

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.