Iphone 方法的返回值
我有一个返回NSMutableArray的方法。。我从另一个类调用这个方法,我想知道如何将返回的NSMutableArray放入调用它的类中的接收对象中 myClass.mIphone 方法的返回值,iphone,ios,nsmutablearray,Iphone,Ios,Nsmutablearray,我有一个返回NSMutableArray的方法。。我从另一个类调用这个方法,我想知道如何将返回的NSMutableArray放入调用它的类中的接收对象中 myClass.m - (NSMutableArray *)getMutableArray { // Do some stuff return myMutableArray } - (void)getMeMyMutableArray { // not really sure what to do here.. but
- (NSMutableArray *)getMutableArray
{
// Do some stuff
return myMutableArray
}
- (void)getMeMyMutableArray {
// not really sure what to do here.. but something like.....
// initialize class
myClass *mc = [[myClass alloc] init];
// call myClass method
[mc getMutableArray]; // how do I get the returning value into a mutableArray in this class?
}
mycallingClass.m
- (NSMutableArray *)getMutableArray
{
// Do some stuff
return myMutableArray
}
- (void)getMeMyMutableArray {
// not really sure what to do here.. but something like.....
// initialize class
myClass *mc = [[myClass alloc] init];
// call myClass method
[mc getMutableArray]; // how do I get the returning value into a mutableArray in this class?
}
希望这是有道理的。。任何帮助都将不胜感激NSMutableArray*myArray=[myClass getMutableArray] 或者特别是因为您将实例命名为“mc”NSMutableArray*myArray=[mc getMutableArray]
getMutableArray
是一个实例方法,所以它应该是NSMutableArray*myArray=[mc getMutableArray]代码>如你所说。