我来自 Flash ActionScript 背景。我来自哪里,我可以像这样设置一个类似字典的对象:
var data:Object = {startPoint:5, endPoint:12};
所以来到Objective-C,我惊讶地发现与此等价的似乎是:
NSMutableDictionary *data = [NSMutableDictionary dictionary];
[data setObject:[NSNumber numberWithInt:5] forKey:@"startPoint"];
[data setObject:[NSNumber numberWithInt:12] forKey:@"endPoint"];
当然有更简单的方法......或者这真的是我的命运吗?