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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:41:06+00:00 2026-06-06T17:41:06+00:00

I am not entirely sure how to explain my problem but I will try.

  • 0

I am not entirely sure how to explain my problem but I will try.

So I have been trying to learn how to use delegates and protocols and ran into a problem. I have a protocol: ButtonInPopOverWasPressed, with one method:

   - (void)buttonWasPressed:(NSString *)buttonValue;

I also have a main view controller and a custom popover class with the property:

   @property (retain, nonatomic) id <ButtonInPopoverWasPressed> delegate;

In my main view controller I have a button and a text label. When the button is pressed it segue’s to a normal popover. I then assign the segue.destinationViewController’s delegate to be the main view controller like so:

   [segue.destinationViewController setDelegate:self];    

Then when a button from the popover is selected it is displayed in the main view’s text label by calling a protocol method that the main view listens for:

   [self.delegate buttonWasPressed:sender.currentTitle]; // sends the title of the button pressed to the delegate

This all works fine. My problem started when I wanted to have the popover transition to different views when a button was pressed instead of sending the information back to main view. But when I created a Navigation Controller as the popover and set the relationship to the old popover everything broke.

When I assign the delegate of the segue (shown above) it comes out on the other side as null so I completely lose my ability to pass it to other subviews and get information back to the main view. Does the Navigation Controller suck up the delegate? How do I get the delegate through the NC to the actual views?

I know this is Protocol and Delegate basics but I have looked around and can never seem to find an answer that has worked for me.

  • 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-06T17:41:08+00:00Added an answer on June 6, 2026 at 5:41 pm

    Try the following code out.

        NSArray *temp = [[segue destinationViewController] childViewControllers];
        PopoverViewController *popoverViewController = (PopoverViewController)[temp objectAtIndex:0];
        popoverViewController.delegate = self;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I am not entirely sure if I will explain this sufficiently, but here
Not entirely sure this is possible, but hoping to be pleasantly surprised. I have
not sure if the subject entirely conveys what I'm trying to achieve, but let
I'm not entirely sure how to post this question, but here goes... I have
I'm not entirely sure if this is even possible, but I'll try my best
Not entirely sure how to adequately title this problem, but it entails a need
Not entirely sure my question title describes what I want to do, but couldn't
I'm not entirely sure what's breaking here on this page: http://grandoaks.org/floor.html but it seems
I'm not entirely sure if I can do what I want here, but I
I'm not entirely sure whats happened here. I may have messed things up somewhere,

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.