0

我是 iphone 新手,我有一个小小的疑问,即我在下面的类中有一个方法

-(void)bookNamesWhichAreInDownloadedQueue:(NSMutableArray *)receivedBookNamesWhichAreInDownloadedQueue{
    NSLog(@"receivedBookNamesWhichAreInDownloadedQueue is %@",receivedBookNamesWhichAreInDownloadedQueue);
    bookNamesWhichAreInDownloadedQueue = receivedBookNamesWhichAreInDownloadedQueue;
    NSLog(@"bookNamesWhichAreInDownloadedQueue is %@",bookNamesWhichAreInDownloadedQueue);
}

这里 bookNamesWhichAreInDownloadedQueue 是一个 NSMutableArray 它包含一些数据。我想在同一个类的另一个方法中用该数据检索这个数组,这是怎么可能的。如果有人知道这一点,请帮助我

4

1 回答 1

2

创建一个返回的方法NSMutableArray

-(NSMutableArray*)bookNamesWhichAreInDownloadedQueue:(NSMutableArray *)receivedBookNamesWhichAreInDownloadedQueue{
    NSLog(@"receivedBookNamesWhichAreInDownloadedQueue is %@",receivedBookNamesWhichAreInDownloadedQueue);
    bookNamesWhichAreInDownloadedQueue = [[NSMutableArray alloc] initWithArray:receivedBookNamesWhichAreInDownloadedQueue];
    NSLog(@"bookNamesWhichAreInDownloadedQueue is %@",bookNamesWhichAreInDownloadedQueue);
    return bookNamesWhichAreInDownloadedQueue;
}

现在您可以从要检索NSMutableArray!!的方法中调用此方法

祝一切顺利!!!

于 2012-07-13T06:38:00.157 回答