iPhone的日期和时间在哪里?获取时区列表的时间 [英] Where is the iPhone's Date & Time getting its time zone list

查看:31
本文介绍了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 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的日期和时间在哪里?获取时区列表的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆