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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:13:08+00:00 2026-05-25T01:13:08+00:00

This is the delegate @protocol DropControllerDelegate; @interface DropController : NSObject id<DropControllerDelegate> delegate; } @property

  • 0

This is the delegate

@protocol DropControllerDelegate;

@interface DropController : NSObject
   id<DropControllerDelegate> delegate;
}

@property (nonatomic, assign) id<DropControllerDelegate> delegate;
+ (DropController*) sharedController;

@protocol DropControllerDelegate <NSObject>
- (void)openUserButtons;
- (void)startUpload;
- (void)uploadDone;
- (void)uploadFailed;
- (void)startDownload;
- (void)downloadDone;
- (void)subFolderLoaded;
@end

This is the singleton code:

static DropController *sharedCont = nil;

#pragma mark Singleton stuff

+ (DropController *) sharedController {
    @synchronized(self)     {
        if (!sharedCont)
            sharedCont = [[DropController alloc] init];
        return sharedCont;
    }
    return sharedCont;
}

The code to set the delegate is (in both myControllerA and myControllerB):

DropController* dropHelper = [DropController sharedController];
dropHelper.delegate = self;

I’m able to receive the calls in one controller but not in the other controller (the code is a copycat), this is driving me crazy!

  • 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-25T01:13:08+00:00Added an answer on May 25, 2026 at 1:13 am

    As i said in my comment, since you are using a shared instance of that object, it will overwrite the previously set delegate to the new object. So i would suggest to hold a array in your sharedController. Add objects to that array which will want to become the delegates to the sharedController.

    Then iterate through that array and call the method over each object in it. Its pretty simple.


    Edit:

    When you assign the delegate in your viewcontroller A with the statement dropHelper.delegate = self; object A becomes the delegate. Calling the method [delegate openUserButtons]; will trigger the method in viewcontroller A. But when you do dropHelper.delegate = self; in viewcontroller B, [delegate openUserButtons]; will call the method in object B. It will not call both the methods from a and b. Since there is only one delegate variable and you are using a shared singleton object.

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

Sidebar

Related Questions

I'm doing something like this: @protocol CallbackDelegate -(void) performCallback; @end @interface MyObject : NSObject
I have defined a protocol like this: @protocol RSSItemParserDelegate <NSObject> - (void)RSSItemParser:(RSSItemParser *)parser didEndParsingSuccesfully:(BOOL)success;
Right now, I have to do this private delegate void set(int obj); //declare the
I have this method: private delegate void watcherReader(StreamReader sr); private void watchProc(StreamReader sr) {
Compiler Error Keyword 'this' is not available in the current context delegate void CallBack(int
I found out this: applicationDidFinishLaunching (an delegate method of the UIApplicationDelegate Protocol) seems to
Several times I've seen ReSharper generate code that looks like this: delegate void myHandler(int
I have a controller with a delegate. @interface MyConversionController : NSObject { id <ConversionDelegate>
I have defined a delegate protocol in my custom class this way: #import <Foundation/Foundation.h>
I have this delegate in C#. public delegate string ACSharpDelegate(string message); How would I

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.