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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:45:57+00:00 2026-05-23T09:45:57+00:00

I have view controller A, table view controller B and view controller C. In

  • 0

I have view controller A, table view controller B and view controller C. In A’s viewDidLoad method I add B as a subview of A. When an outlet in A is tapped then C is presented as a modal view. When an outlet is tapped in C; I need to call some method in B. How can I set B as C’s delegate if there is no direct relationship between the two? Is there another 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-23T09:45:57+00:00Added an answer on May 23, 2026 at 9:45 am

    You may need to rethink your design. If “there is no direct relationship between B and C”, then C should not be calling methods on B. If C does need to call methods on B, then there is a relationship.

    That said, since your view controller A knows about both of these objects, it can act as the link between them. You can have C call a method on A, which will then call a method on B. Of course, this requires C to have a reference to A; since you say that C is presented when a button is tapped in A, C has such a reference through its parentViewController property. For example:

    // In C
    - (IBAction) buttonPressed {
        [self.parentViewController passMessageToB:self];
    }
    
    // In A
    - (void) passMessageToB: (id)sender {
        // sender is a reference to C, so B will be able to
        // pass information back if needed
        [B actOnMessageFromC:sender];
    }
    
    // In B
    - (void) actOnMessageFromC: (id)sender {
        // Do whatever is needed
    }
    

    It’s possible to make this even more complex — you could even pass a particular selector to A that it could call on B, but at that point I think you would definitely need to reconsider your design and the connections between B and C.

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

Sidebar

Related Questions

I have view controller, into the view i have put a table view, and
I have a Table View Controller with cells. I want to update the text
I have a table view controller with custom cells. In those cells i added
I have a table view controller which doesn't let me manually scroll to the
I have a navigation controller which also has a table view. I want to
I have a view controller that gets presented modally and changes some data that
i have this MainViewController, which is a controller for my table view. Whenever I
I've a UIView - containerView . I have a table view controller - aTableViewController
i have table view and when user click on any row then he should
I have this in my table view controller, and i want to pass the

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.