Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Using multiple instances of the same Mediator  (Read 10241 times)
saad
Sr. Member
****
Posts: 65


View Profile Email
« on: December 28, 2010, 05:57:10 »

http://blog.loadvars.com/2009/07/07/using-multiple-instances-of-the-same-mediator-in-puremvc/

In view of the above post, how to accomplish the same for Objective-C Port?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: December 29, 2010, 09:12:49 »

The mediator just has to have a unique name. In the demo you linked to, that name is a concatenation of the view component's id property and the mediator's NAME constant. Does your view component not have the equivalent of an id property?

-=Cliff>
Logged
saad
Sr. Member
****
Posts: 65


View Profile Email
« Reply #2 on: January 10, 2011, 04:43:59 »

Hi:

I worked it out using following strategy,

@implementation CigaretteMediator

+ (NSString *)NAME {
    return @"CigaretteMediator";
}

- (void)initializeMediator {
    self.mediatorName = [[CigaretteMediator NAME] stringByAppendingString:[viewComponent name]];
}

in my view component had to create a function and property ([viewComponent name]), for setting and retrieving a unique name, though I was looking for a built-in property such as what Cliff suggest like id something, is there something like that we can set and get a built-in property programmatically for each UIViewController
« Last Edit: January 10, 2011, 04:45:43 by saad » Logged
Pages: [1]
Print