hugo411
hugo411

Reputation: 346

obj-c : iphone programming, call method with 2 parameters

i have a method that call another method with 1 parameter to another class. It is working perfectly but now i need 1 more parameters this is my code :

i am getting a 'addobject may not respond'

test.m

calling method :

DrunkeNewIdeaAppDelegate *appDelegate = (DrunkeNewIdeaAppDelegate *)[[UIApplication sharedApplication] delegate];
  Testes *myLevelObject = (Testes *)appDelegate.testViewController1;
  [myLevelObject addobject:rephereanswer,nbimportant];

method called :

testes.h

-(void)addobject:(double)rephereanswer:(double)nbimportant;

testes.m

-(void)addobject:(double)rephereanswer:(double)nbimportant{

Upvotes: 0

Views: 4352

Answers (2)

mipadi
mipadi

Reputation: 410662

The signature of your method is actually addObject: :. Parameters are preceded by colons, so you'd call your method like so:

[myLevelObject addobject:rephereanswer :nbimportant];

However, in Objective-C, the prevailing style is to name all of your parameters, so you'd probably want to change your method to this:

- (void)addobject:(double)rephereanswer otherParam:(double)nbimportant;

In which case you'd call it like this:

[myLevelObject addobject:rephereanswer otherParam:nbimportant];

(A more descriptive name than otherParam is desirable, too.)

Upvotes: 1

Donald Byrd
Donald Byrd

Reputation: 7778

Try this

[myLevelObject addobject:rephereanswer :nbimportant];

Upvotes: 2

Related Questions