NSArray *arr = @[@"Helo", @"Word"];
NSLog(@"%d", (int) arr.count); // 1. 什么情况下这样调用方法?
NSUInteger count = [arr count]; // 2. 什么情况下这样调用? 似乎两者均可
NSLog(@"%lu", (unsigned long)count);
高洛峰2017-04-24 09:14:19
@testHs’ statement is not accurate.
Dot syntax is used to access attribute access methods (getters and setters), setter
方法显然是要传入参数的。方式为object.propertyName = something
You can do everything [] that dot syntax can do (not necessarily vice versa), but dot syntax is more convenient.
阿神2017-04-24 09:14:19
Both are available.
When using [], you can pass parameters in, but when using ., you cannot pass parameters.