标签: iphone objective-c ios uiview addsubview
答案 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。