从数组中获取特定对象

Get particular object from an array

我的数组对象包含多个对象。如何从数组中获取特定对象。我的数组(_arrSection)是

<__NSArrayM 0x7fa53a69d380>(  //////_arrSection
<__NSArrayI 0x7fa53c8422e0>(
29077
)
,
<__NSArrayI 0x7fa53a531930>(
32102.38,
67419.6,
25913.85,
247547.66,
52869.06
)
,
<__NSArrayI 0x7fa53a56f560>(
43173,
197220.19,
108825
)
,
<__NSArrayI 0x7fa53a530150>(
199476.25,
814590.87
)
)

现在我只想得到以下值

<__NSArrayI 0x7fa53a56f560>(
43173,
197220.19,
108825
)

像这样尝试

NSArray *tempArray = [yourArray objectAtIndex:index]; 
NSLog(@"Print Temp Array %@",tempArray);

更新

Use for replace value 
[_arrSection replaceObjectAtIndex:index withObject:@"Replace Value Set Here"];

打印值后..你会得到你想要的一样。希望你会成功..谢谢:)

您可以使用 NSArray 的 objectAtIndex 属性。使用索引号从 NSArray 中获取对象。

喜欢 NSArray *getArray = [_arrSection objectAtIndex:2];

试试这个。

NSMutableArray *sectionArray = [[NSMutableArray alloc]init];
[sectionArray addObject:[[NSArray alloc] initWithObjects:@(29077), nil]];
[sectionArray addObject:[[NSArray alloc] initWithObjects:@(32102.38),@(67419.6),@(25913.85),@(247547.66),@(52869.06), nil]];
[sectionArray addObject:[[NSArray alloc] initWithObjects:@(43173),@(197220.19),@(108825), nil]];
[sectionArray addObject:[[NSArray alloc] initWithObjects:@(199476.25),@(814590.87), nil]];

int sectionIndex = 2;
NSArray *rowArray = [sectionArray objectAtIndex:sectionIndex];//
NSLog(@"rowArray:%@",rowArray);

int rowIndex = 1;
NSNumber *value = [rowArray objectAtIndex:rowIndex];//rowIndex
NSLog(@"rowIndex value:%@",value);