开发者

Is this kind of notation legal in Objective - C

开发者 https://www.devze.com 2023-03-10 22:34 出处:网络
CLLocationCoordinate2D coord = {latitude: 61.2180556, longitude: -149.9002778}; MKCoordinateSpan span = {latitudeDelta: 0.2, longitudeDelta: 0.2};
CLLocationCoordinate2D coord = {latitude: 61.2180556, longitude: -149.9002778};
MKCoordinateSpan span = {latitudeDelta: 0.2, longitudeDelta: 0.2};
MKCoordinateRegion region = {coord, span};

What is this? Curly brackets?

Also shouldn't that be CLLoca开发者_如何转开发tionCoordinate2D * coord

I saw them on http://www.iphonedevsdk.com/forum/tutorial-discussion/39374-mkmapview-tutorial-using-latitude-longitude.html

Totally strange.


This is C99 “designated initializer” syntax for initializing structs. (It has nothing to do with the Objective-C concept of “designated initializers” for classes.)

0

精彩评论

暂无评论...
验证码 换一张
取 消