MGTwitterEngine delegate change

I installed and successfully logged in via xAuth using the extended MGTwitterEngine class, my question is if I want to pass this to another view controller, how can I change the delegate class, as this is some kind of weak link

@interface MGTwitterEngine : NSObject <MGTwitterParserDelegate> {
__weak NSObject <MGTwitterEngineDelegate> *_delegate;

I would best end this up in a singleton class and get along so it seems excessive to log in every time, or I missed the painstakingly obvious way of sharing this object around

At the moment, I have added the setDelegate method to MGTwitterEngine, but I feel like I am struggling with a map unnecessarily

+5
source share
3 answers

, , - / . , , , - , . - , , , .

- , , , .., .

, ( , ?), . MGTwitterEngine, " API Twitter NSString, ". ( ) . twitter / , , , .

+6

, . - , MGTwitterEngine. , . :

nextViewController._mgTwitterEngine = self.mgTwitterEngine;
nextViewController.mgTwitterEngine.delegate=nextViewController;

nextViewController. , ( viewDidAppear, viewWillAppear).

, ... !

+2

Use NSNotifications in the delegate.

Create a view controller where you want the delegate to add an observer. Ask the delegate method for MGTwitterEngine to post a notification.

0
source

All Articles