1.
Nsmutablearray (variable group) Nsmutablearray *MARR2 = [[Nsmutablearray alloc]initwithobjects:@ "1", @ "2", @ "3", nil]; Nsmutablearray *marr1 = [[Nsmutablearray alloc]init];//because it is a mutable array, you just need to give an empty group, so just use init Add to [Marr1 addobject:@ "1"]; [Marr1 addobject:@ "22"]; [Marr1 addobject:@ "CC"]; NSLog (@ "%@", marr1);/*2015-04-16 16:31:41.846 oclesson4_nsstring[2177:116050] ( 1, 22, Cc )*/ |
2.
//Delete, cannot cross the border, error [marr1 removeobjectatindex:0]; NSLog (@ "%@", marr1);/*2015-04-16 16:32:46.124 OCLesson4 _NSSTRING[2188:116498] ( , cc ) */ |
3.
Insert, can not cross the border, that is, error [Marr1 insertobject:@ "AAA" atindex:0]; NSLog (@ "%@", marr1);/*2015-04-16 16:37:38.586 oclesson4_nsstring[2230:118462] ( Aaa 02n Cc )*/ |
4.
Exchange, can not cross the border, that is, error [Marr1 exchangeobjectatindex:0 Withobjectatindex:2]; NSLog (@ "%@", marr1);/*2015-04-16 16:37:38.586 oclesson4_nsstring[2230:118462] ( Cc 22, Aaa )*/ |
5.
Change, can not cross the border, that is, error Marr1[0] = @ "5"; NSLog (@ "%@", marr1);/*2015-04-16 16:37:38.586 oclesson4_nsstring[2230:118462] ( 5, 02n Aaa )*/ |
Nsmutablearray (variable group) (ix)