Objc基础学习记录3

在学习Objective-c中,

数组

1.NSArray,

这是一个不可变的数组,不能修改和删除其中的对象,可以存储任意objective的对象指针.

不能存储int,char类型的,,需要转换为需要的类型.

 

要快速枚举数组中的值,用in.

1 for (NSString *eleement in myArray)
2     NSLog(@"myArray is %@",element);

2.NSMutableArray

这是一个可变的数组,可以向其中添加和删除对象.

  a.添加addObject方法.

  

[myListArray addObject : str];

  b.删除removeObject

[myListArray removeObject: str];

  c.修改数组中的某一元素replaceObjectAtIndex

[myListArray replaceObjectAtIndex: ID withObject: str ];

  d.inserObject插入元素,

[myListArray insertObject: str atIndex: ID];

 

 

 
posted @ 2014-08-05 21:53  叉叉敌  阅读(177)  评论(0编辑  收藏  举报