Reputation: 17892
I have two classes, a class1 which is an NSObject and a class2 which is a UIViewController... From the UIViewController I sent something to class1 to get it to do an action:
[class1 doVoidAction];
and in class1 I have:
-(void)doVoidAction{ blah blah blah }
That worked fine... but after it's done doing the void action I need it to send something back to the view controller to do something over there now... So I tried the same method, including the .h files, saying @class class2; I did this whole deal:
@interface class1 : NSObject {
class2 *class2;
}
And in class2 I have in the .h file -(void)action2; and in the .m I have -(void)action2{ blah blah blah }
But for whatever reason they do not seem to want to communicate back that way! normally I would just hook up things int he xib file and do that but since class1 is an NSObject I can't use IBOutlet and hook up things in the xib file, to my knowledge at least.
What do I do?
Upvotes: 0
Views: 575
Reputation: 31016
You could change your method to be something like:
-(void)doVoidActionFor:(UIViewController *)controller { blah blah blah }
You would call it as:
[class1 doVoidActionFor:self];
And the last 'blah' would be:
[controller action2];
Upvotes: 1