How to display NSTimeInterval binding as NSDate in InterfaceBuilder?
I handle a lot of time stamps that I store as NSTimeInterval.
NSDateComponents* comps = [[NSDateComponents alloc] init];
[comps setYear: ....
NSDate* date = [gregorian dateFromComponents:comps];
NSTimeInterval timeStamp = [date timeIntervalSinceReferenceDate];
Interface Builder has a table view binding to the variable of the time stamp. How can I format the (double value of) NSTimeInterval into a human readable date format? The Interface Builder Table Column Bindings palette has a input field Value Transformer - can I do someth开发者_如何学Cing here?
The trick is to drag and drop NSDateFormatter from the Library panel to the table view cell.
精彩评论