Hello all,
let's say in a project there are 1.h, 1.m, 2.h and 2.m if i have a function inside 2.m how can call it from 1.m
Thanks Bob
Hello all,
let's say in a project there are 1.h, 1.m, 2.h and 2.m if i have a function inside 2.m how can call it from 1.m
Thanks Bob
Calling a "function" is just like in C.
If you mean "How do I call a method of an object", then it's something like this:
// 2.h
@interface MyMailer
-(void)SendMail();
@end
// 2.m
#import "2.h"
@implementation MyMailer
-(void) SendMail()
{
printf("My function has been called\n");
}
@end
// 1.m
#import "2.h"
void foo()
{
MyMailer *mailer = [[MyMailer alloc] init];
[mailer SendMail];
[mailer release];
}
The Wikipedia article on Objective-C has some similar examples.