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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:22:14+00:00 2026-06-03T14:22:14+00:00

I declared a protocol in the header file of a Controller that manages a

  • 0

I declared a protocol in the header file of a Controller that manages a map view.

@protocol UCMapViewDelegate <NSObject>
@required
- (void)pushMapviewRight;

@end

I’m declaring the implementation of the protocol in another view controller (.h) and implement it in the .m file

// in the UCRootViewController.h
@interface UCRootViewController : UIViewController <UCMapviewDelegate>

// in the UCRootViewController.m
- (void)pushMapviewRight
{
    NSLog(@"push mapview right");
}

I’m setting the delegate to a property that points to the rootviewController. This is done in the viewDidLoad() of my MapviewController, with a property @property (weak, nonatomic) id<UCMapViewDelegate> delegate;.

// in UCRootViewController
self.mapviewController.rootviewController = self;

// in UCMapViewController
self.delegate = (id<UCMapviewDelegate>)self.rootviewController;

Calling the delegated method. showMenu() gets executed when a button in the mapviewController gets pressed and it works. but the delegate method does NOT get called.

- (void)showMenu
{
    NSLog(@"show menu");
    [self.delegate pushMapviewRight];
}

But nothing happens.. what is wrong?! Help is greatly appreciated!

  • 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-03T14:22:15+00:00Added an answer on June 3, 2026 at 2:22 pm

    I fixed it. At first I used NSLog to verify that self was not nil (which is pretty obvious
    , but still) I’m actually not sure why, but self.mapviewController.rootviewController = self; did not “carry over” to the point where I wanted to reference self.rootViewController, although self was not nil at the point where I set it to be the pointer to rootViewController.

    I fixed it by creating another initWithRootViewController:(UCRootViewController*) ctrland passed self as an argument when I created the MapViewController.

    Can someone explain why the valid reference to self (=rootViewController), was not available in the MapViewController?

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

Sidebar

Related Questions

Assume that: New Protocol is declared Method in this protocol is marked @required Class
my protocol: @protocol ElectricalSystemEngineDelegate -(void)didRequestMainMenu:(id)sender; @end I designed this protocol in order to handle
I am adding a protocol to Prestented View Controller to establish a relationship between
I have a method called dateSelectViewController declared in my .h file as a protocol:
I declared a delegate: public delegate void Del(string message); Then i created a function
I declared a NSArray object in .h file as @property (nonatomic, assign) NSArray *scnArray;
I have a map declared as follows: map < string , list < string
I have this in my view controller: [[[UIApplication sharedApplication] delegate] sendMessageAsSingleObject:[sender currentTitle]]; Which gives
I'm running into an odd quirk involving Core Data, a declared protocol, and perhaps
I've experienced something today while I'm building my app. I've declared a protocol in

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.