Document directory
- Nsnumber Value assignment:
- Nsarray assignment and access:
- Nsdictionary assignment and access:
New syntax features of objective-C 1. Improvement of enumeration types
Previously, I declared that the enumeration method is based on the C ++ habit:
Typedef Enum {HUMAN, monkey, chiecken, cow} animals;
The new statement is as follows:
Typedef Enum animals: nsuinteger {HUMAN, monkey, cow} animals;
Enum can be bound to the data type.
2. nsnumber assignment in simplified Syntax:
Nsnumber * value; value = @ 12345; value = @ Yes; value = @ 3.14f;
Nsarray assignment and access:
Nsarray * array; array = @ {1, 2, 3}; array = @ {A}; array [I] = 23;
Nsdictionary assignment and access:
Nsdictionary * dict;
Dict =@{ key1: obj1, key2: obj2 };
Dict = @{};
Dict [key1] = obj3;
Summary
Although, it's just some simple syntactic sugar. But it makes objective-C easier to use. That is, how does one feel more and more like C #/Java?