Search code examples
objective-cvariablesimplementationsharing

passing variables


Ok here is an example of what I'm dealing with at the moment:

@implementation ECHOAppDelegate
 ...
 @end

 @interface PtyView (PtyPrivate)
 -(void)startTask;
 -(void) didRead: (NSNotification *)fileNoty;
 @end

 @implementation PtyView
 ...
 -(void)startTask {
 //starts task
 }
 @end

Now, if I wanted to "trigger" startTask from the ECHOAppDelegate implementation, how would I do that? Now, it says that it wasn't declared.


Solution

  • First, make sure you import the PtyView header. In ECHOAppDelegate.m:

    #import "PtyView.h"
    

    Then, assuming you have an instance of PtyView:

    [myPtyViewObj startTask];