返回方法的值

时间:2012-09-18 04:06:44

标签: iphone ios nsmutablearray

我有一个返回NSMutableArray的方法..我从另一个类调用此方法,我想知道如何将返回的NSMutableArray放入调用它的类中的接收对象。

myClass.m

- (NSMutableArray *)getMutableArray
{
    // Do some stuff

    return myMutableArray
}

mycallingClass.m

- (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?
}

希望这是有道理的......任何帮助都会受到赞赏

1 个答案:

答案 0 :(得分:1)

NSMutableArray * myArray = [myClass getMutableArray];