如何在Objective-C中存储星期几和时间? [英] how do I store a day-of-week and time-of-day in objective-c?

查看:30
本文介绍了如何在Objective-C中存储星期几和时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将一周中的一天和一天中的时间存储在Objective-C中?

how do I store a day-of-week and time-of-day in objective-c?

即例如相当于7.30pm的WED

i.e. the equivalent of WED's at 7.30pm for example

是否有一个特定的Objective-C对象可以做到这一点?

Is there one specific objective-c object that would do this?

推荐答案

NSDateComponents是一个好的开始,但是NSDateComponents的实例仅在特定的NSCalendar实例的上下文中才有意义,因此您需要研究一下上课这些类一起用于构造(和解构)NSDate对象.

NSDateComponents would be a good start, but an instance of NSDateComponents only makes sense in the context of a particular NSCalendar instance, so you'll want to look into that class, too. Those classes are used together to construct (and deconstruct) NSDate objects.

这篇关于如何在Objective-C中存储星期几和时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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