How to store int in Core Data with NSTableView binding NSArrayController?
I'm developing a core data a application and I have a attribute of an entity that have type "integer16" (int).
I would to set it through a NSTableView
, that is bind to core data through a NSArrayController
.
I put a NSDateFormatter
in the NSTableViewColumn
to format the date's column, and it works because NSDateFormatter
returns a NSDate
.
But with NSNumberFormatter
doesn't work, because NSNumberFormatter
returns a NSNumber
, not int or NSInteger
(the type set in core data).
Where can I call the method [mynsnumber intValue]
to set the int value开发者_运维技巧 in my core data every time user changes the value?
Because you haven't explained why you're trying to store a date as an integer, I'm going to go for the obvious answer: Use a date type to store a date in Core Data.
If it's not a date, then you really need to explain - in detail - exactly what you're trying to accomplish, rather than ask us how to force it to work the way you think it should.
Specific questions in my mind: What exactly does this attribute represent? How do you want to represent it to your user (how should it be formatted - note I'm not asking you what formatter you want to use; what is the goal, not the means you assumed would get you there)?
精彩评论