How should I properly store hour:minute data of my entity in CoreData? In .NET I could use TimeSpan class, how about objective C? The options I see: 1)use CoreData Date type (NSDate?) and ignore every component except for hour and minute 2)use custom 开发者_运维百科type based on string stored as "HH:MM" 3)store two integers
What would you recommend?
I would use the NSTimeInterval class, much like the TimeSpan .NET class.
NSTimeInterval
is the correspondant data type: iphone - store NSTimeInterval on a coredata
However, if your data is large, I would suggest the optimization to store two integers instead. If you decide to later on also store seconds, the NSTimeInterval
solution is a more flexible one.
精彩评论