Sunday 15 June 2014

ios5 - How TO Use NSArray objectAtIndex: shorthand -



ios5 - How TO Use NSArray objectAtIndex: shorthand -

> [is there literal dictionary or array syntax in objective-c?]

an objective-c subscript look occurs when base of operations operand of c subscript operator has objective-c object pointer type. since potentially collides pointer arithmetic on value, these expressions supported under modern objective-c runtime, categorically forbids such arithmetic

i have noticed unusual seems work in objective-c.

when have array,

nsarray *myarray = @[@"1", @"b", @"3", @"d"];

i can access sec element by,

nsstring *element = [myarray objectatindex:2];

however seem able access via.

nsstring *element = myarray[2];

does know if defined behaviour , hence safe use, or should avoid it? can help!!

ios5

No comments:

Post a Comment