Here is my code:
//ECHOAppDelegate.m
@implementation ECHOAppDelegate
...
@end
//PtyView.m
@interface PtyView (PtyPrivate)
-(void)startTask;
-(void) didRead: (NSNotification *)fileNoty;
@end
@implementation PtyView
...
-(void)startTask {
//starts task
}
@end
Now, how do I trigger “startTask” from ECHOAppDelegate.m? I need to create an instance? I’m a total beginner 😀
Any example code would be awesome!
Thanks,
Elijah
-(void)startTask;appears to be private implementation and in theory should not be called from external classes.To answer your question, you can call it something like this:
Though you will get a warning saying,
PtyViewmight not respond tostartTask. Since it is not in public interface of class.Update: Above code assumes that when
startTaskreturns, you are done with this object. But something tells me that you might be using async callbacks. If that is the case thenstartTaskmight return immediately and you won’t release it then and there. Normally in this case, you will be notified byPtyViewabout the completion of task. So you release it when the task is complete.Update2:
Making a method public is easy. You just declare it in the public interface (the header file of class):
Notice that there is no category defined in the interface declaration.