How to call a function with parameters in Objective c?

This post deals with calling of function with parameters…

Suppose we have a class “Hello”

In Hello.h file declare the function as

-(void) getUpdates:(NSString *)value1  string1:(NsString *)value2 string2:(NSString *)value3;

In Hello.m write the definition of function

-(void) getUpdates:(NSString *)value1  string1:(NSString *)value2 string2:(NSString *)value3

{

//function definition

}

Now to call this function from some other class say “World”

Import Hello class in World class as

#import "Hello.h"

 

Initialize the Hello class object in World.m

Hello *obj=[[Hello alloc] init];

Now call the function with parameters

[obj getUpdates:@"Data " string1:@"is" string2:@"updated"];