Skip to content

Commit 7df9108

Browse files
committed
时间显示
1 parent 3aaf10f commit 7df9108

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</dict>
3737
</array>
3838
<key>CFBundleVersion</key>
39-
<string>4.3.201702171500</string>
39+
<string>4.3.201702221600</string>
4040
<key>ITSAppUsesNonExemptEncryption</key>
4141
<false/>
4242
<key>LSApplicationQueriesSchemes</key>

Coding_iOS/Util/OC_Category/NSDate+Common.m

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,32 @@ - (NSString *)stringTimesAgo{
7777

7878
NSString *text = nil;
7979

80-
NSInteger agoCount = [self monthsAgo];
80+
NSInteger agoCount = [self yearsAgo];
8181
if (agoCount > 0) {
82-
text = [NSString stringWithFormat:@"%ld个月前", (long)agoCount];
82+
text = [NSString stringWithFormat:@"%ld年前", (long)agoCount];
8383
}else{
84-
agoCount = [self daysAgoAgainstMidnight];
84+
agoCount = [self monthsAgo];
8585
if (agoCount > 0) {
86-
text = [NSString stringWithFormat:@"%ld天前", (long)agoCount];
86+
text = [NSString stringWithFormat:@"%ld个月前", (long)agoCount];
8787
}else{
88-
agoCount = [self hoursAgo];
88+
agoCount = [self daysAgoAgainstMidnight];
8989
if (agoCount > 0) {
90-
text = [NSString stringWithFormat:@"%ld小时前", (long)agoCount];
90+
text = [NSString stringWithFormat:@"%ld天前", (long)agoCount];
9191
}else{
92-
agoCount = [self minutesAgo];
92+
agoCount = [self hoursAgo];
9393
if (agoCount > 0) {
94-
text = [NSString stringWithFormat:@"%ld分钟前", (long)agoCount];
94+
text = [NSString stringWithFormat:@"%ld小时前", (long)agoCount];
9595
}else{
96-
agoCount = [self secondsAgo];
97-
if (agoCount > 15) {
98-
text = [NSString stringWithFormat:@"%ld秒前", (long)agoCount];
96+
agoCount = [self minutesAgo];
97+
if (agoCount > 0) {
98+
text = [NSString stringWithFormat:@"%ld分钟前", (long)agoCount];
9999
}else{
100-
text = @"刚刚";
100+
agoCount = [self secondsAgo];
101+
if (agoCount > 15) {
102+
text = [NSString stringWithFormat:@"%ld秒前", (long)agoCount];
103+
}else{
104+
text = @"刚刚";
105+
}
101106
}
102107
}
103108
}

0 commit comments

Comments
 (0)