Method Return NSMutableDictionary
Hello all i have a method 开发者_如何学Pythonin nsobject ie
-(NSDictionary*)DictionaryValues:(NSArray*)arrayList{
//calling delegate method....
return (nsmutabledictionary*);
}
Here how to return dictionary when calling this method.
i used dictionaryProductInformation but its not working.
A few things:
- Please adhere to the Objective-C guidelines, which say that method names should begin with a lowercase letter
- If you always return an
NSMutableDictionary
, then you may state that in the return value declaration (but that may not be necessary, your choice) - If you create the dictionary inside the method, and your method name does not begin with new, init or copy, then please also adhere to the guidelines and return an autoreleased object
That said, your method should look like:
- (NSMutableDictionary *) dictionaryValues:(NSArray*)arrayList{
// ...
NSMutableDictionary *yourDictionary = [NSMutableDictionary dictionary];
// do something with your dictionary
return yourDictionary;
}
精彩评论