FormatterKit NSFormatter 子类集合开源项目

我要开发同款
匿名用户2015年09月17日
38阅读
所属分类Objective-C、iOS代码库、其他(Others)
授权协议MIT

作品详情

FormatterKit收集了一系列精心设计的NSFormatter子类,例如信息单元,距离和相对时间间隔。每一个 formatter从他们各自领域的复杂商业逻辑中抽离出来,所以你可以专注用于你的应用程序。

示例代码:

TTTTimeIntervalFormatter *timeIntervalFormatter = [[TTTTimeIntervalFormatter alloc] init];[timeIntervalFormatter stringForTimeInterval:0]; // "just now"[timeIntervalFormatter stringForTimeInterval:-100]; // "1 minute ago"[timeIntervalFormatter stringForTimeInterval:-8000]; // "2 hours ago"// Turn idiomatic deictic expressions on / off[timeIntervalFormatter stringForTimeInterval:-100000]; // "1 day ago"[timeIntervalFormatter setUsesIdiomaticDeicticExpressions:YES];[timeIntervalFormatter stringForTimeInterval:-100000]; // "yesterday"// Customize the present tense deictic expression for[timeIntervalFormatter setPresentDeicticExpression:@"seconds ago"];[timeIntervalFormatter stringForTimeInterval:0]; // "seconds ago"// Expand the time interval for present tense[timeIntervalFormatter stringForTimeInterval:-3]; // "3 seconds ago"[timeIntervalFormatter setPresentTimeIntervalMargin:10];[timeIntervalFormatter stringForTimeInterval:-3]; // "seconds ago"
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论