NSArry 为静态数组,不能往里面添加元素
NSMutableArray 为动态数组,是NSArray 的子类
定义一个数组
NSarray *city = [[NSArray arrayWithObjects:@"beijing",@"shanghai",@"heibei",nil];
必须以nil结束。
方法:
- (undesigned) count
-
- (undesigned) indexofObjext:(id) object
(void) addObject:(id)object;
(void) removeObject:(id);
(void) removeAllObjects:
-(bool) containsObject:obj
(void )insertObject:(id)object
输出所有元素:
for( int i= 0;i<[city count] ;i++)
{
NSLog(@“%@”,[city objectAtIndex:i] );
}