Where is the iPhone#39;s Date amp; Time getting its time zone list(iPhone的日期和时间在哪里?获取时区列表的时间)
问题描述
我可以使用 [NSTimeZone knownTimeZoneNames]
获得时区列表,但这只会给出包含每个时区中的一两个城市的时区 ID.
I can get a list of time zones with [NSTimeZone knownTimeZoneNames]
, but that only gives the time zone IDs which include one or two cities in each time zone.
日期和时间时间设置有一个很棒的城市列表,我还看到其他一些应用程序具有相同的查找列表(如果不相似的话).
The Date & Time settings has a great list of cities and I have seen a few other apps that have the same if not similar lookup lists.
这些列表来自哪里?
我确实需要将所选城市与其时区相关联,例如 Date &时间会.
I do need to relate a picked city to its time zone like Date & Time does.
推荐答案
只有2个?在 3.1 中,[NSTimeZone knownTimeZoneNames]
返回一个包含 401 个元素的数组,而地球上的时区远少于 200 个.
Only 2? On 3.1 the [NSTimeZone knownTimeZoneNames]
returns an array of 401 elements, and there are much less than 200 timezones on the Earth.
我很确定其他应用程序"也使用 +knownTimeZoneNames
,因为这是返回此类列表的唯一公共方法.不过,请确保您的代码是正确的.
I'm pretty sure "other apps" use +knownTimeZoneNames
as well, since this is the only public method returning such list. Please make sure your code is correct, though.
Settings.app 使用 private private AppSupport.framework 中的 noreferrer">CPCity API.它确实有旧金山,但它是私人的.
Settings.app uses the private CPCity API from the private AppSupport.framework. It does have San Francisco, but it's private.
您需要创建自己的数据库(数据可以从/System/Library/PrivateFrameworks/AppSupport.framework/all_cities_adj.plist
复制).
You need to create your own database (the data can be copied from /System/Library/PrivateFrameworks/AppSupport.framework/all_cities_adj.plist
).
这篇关于iPhone的日期和时间在哪里?获取时区列表的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone的日期和时间在哪里?获取时区列表的时间


基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01