iPhone -- MKReverseGeocoder.adminstrativeArea -- 获取状态缩写
在 MKReverseGeocoder 的文档中,administrativeArea 属性为您提供用户当前所处的状态,并且在示例中提到它返回状态名称或其缩写。我想知道是否有人知道如何获得缩写而不是完整的州名...除了那个没有提到如何获得的简短示例之外,我找不到任何东西表明这甚至是一种可能性。
谢谢!
In the documentation for MKReverseGeocoder, the administrativeArea property gives you the current state the user is in, and it mentions in an example that it returns EITHER the state name OR its abbreviation. I am wondering if anyone knows how to get the abbreviation instead of the full state name...I have been able to find nothing that shows this is even a possibility besides that brief example that doesn't mention HOW.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还需要将 MKReverseGeocoder 中的 State 字段转换为两个字母的缩写,因此我创建了此 plist:
https ://github.com/djibouti33/US-State-Abbreviations
这是我的使用方法:
I also needed to convert the State field from MKReverseGeocoder into a two letter abbreviation, so I created this plist:
https://github.com/djibouti33/US-State-Abbreviations
Here's how I use it:
没有办法做到这一点。不知道为什么苹果文档说“CA 或 California”。
将状态转换为 2 个字母的名称很容易。只需创建以下内容的 plist(表或 NSDictionary 也可以): http:// www.usps.com/ncsc/lookups/usps_abbreviations.html 并使用它来查找 2 个字母的缩写。
There is no way to do this. Not sure why the Apple docs say "CA or California".
It's easy to convert state to 2 letter name. Just create a plist (table, or NSDictionary works too) of the following: http://www.usps.com/ncsc/lookups/usps_abbreviations.html and use that to look up the 2 letter abbreviations.