访问数组中的UIView对象

时间:2011-04-06 15:09:51

标签: iphone objective-c ios uiview addsubview

1 个答案:

答案 0 :(得分:6)

要在NSArray中获取 n -th对象,请使用

[array objectAtIndex:n]

e.g。

[[districtArray objectAtIndex:0] addSubview:poiObject];

编辑:从Xcode 4.4开始(2012年7月)支持OP的语法 ,即

[districtArray[0] addSubview:poiObject];

按预期工作。这称为object subscripting