如何检测iPhone常用设置?
I want to detect iPhone's common settings like settings about Mail, Contacts and Calendar.
(source: simonblog.com)
I want to detect this Sort Order and Display Order settings for a native contact book application. Is this possible and how? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于地址簿的设置,可以使用ABPersonGetSortOrdering()和ABPersonGetCompositeNameFormat()方法分别获取排序顺序和显示顺序。
阅读 AdressBook 指南和 ABPerson 类参考。
对于邮件,您可以使用 MFMailComposeViewController 类。我不知道有哪个 API 可以为您提供比这更多的信息。我怀疑苹果会添加一个(作为用户,我更喜欢这种方式)。
对于日历,请参阅此问题:以编程方式在 iPhone 日历中添加自定义事件< /a>
要检测区域设置时区,就像
[NSTimeZone localTimeZone];
一样简单。再次,我邀请您阅读 NSTimeZone 类参考,了解您可以使用此对象执行哪些操作。For the settings about the Adress Book, you can use the methods ABPersonGetSortOrdering() and ABPersonGetCompositeNameFormat() to get respectively the sort order and the display order.
Read the AdressBook guide and the ABPerson class reference.
For mail, you can detect if the device is configured to send email with the class method canSendMail of the MFMailComposeViewController class. I am not aware of an API that give you more information than that. I doubt Apple would add one (and as a user, I prefer it this way).
For calendar, see this question: Programmatically add custom event in the iPhone Calendar
And for detecting the locale timezone, it's as simple as
[NSTimeZone localTimeZone];
. Again, I invite you to read the NSTimeZone class reference, to learn what you can do with this object.