开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜