In your example:
- (int)canFindSquare:(NSString *)param1 array:(NSArray *)param2{
NSLog(@"something");
}
All you need to do to use the params is call the names of the variables you setup. Your method is already declared to return an int, so you need to make sure that you return one when you are done. Then your caller can test for it. This should work
- (int)canFindSquare:(NSString *)param1 array:(NSArray *)param2{
NSLog(@"param1 is %@ and param2 is %@", param1, param2);
// Some tests
return 1;
}
Remember though that ObjC is very clear with how you call things. So you would call your method like this:
canFindSquare:aString array:anArray;
I’d take a look at Apple’s Objective-C conventions guide to brush up on naming. For example I would call the second param “anArray” or something like that. This makes it much more clear what it is you are doing.
0
solved define method with parameters in objective C