Skip to content

Commit 1678499

Browse files
committed
bugfix
1 parent d7c3949 commit 1678499

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

Coding_iOS/Resources/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/Util/OC_Category/NSObject+ObjectMap.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ +(id)objectOfClass:(NSString *)object fromJSON:(NSDictionary *)dict {
197197

198198
for (NSString *key in [dict allKeys]) {
199199
NSString *tempKey;
200-
if ([key isEqualToString:@"description"]) {
200+
if ([key isEqualToString:@"description"] || [key isEqualToString:@"hash"]) {
201201
tempKey = [key stringByAppendingString:@"_mine"];
202202
}else{
203203
tempKey = key;
@@ -358,7 +358,7 @@ +(NSMutableArray *)arrayMapFromArray:(NSArray *)nestedArray forPropertyName:(NSS
358358
// Else, it is an object
359359
else {
360360
NSString *tempNewKey;
361-
if ([newKey isEqualToString:@"description"]) {
361+
if ([newKey isEqualToString:@"description"] || [newKey isEqualToString:@"hash"]) {
362362
tempNewKey = [newKey stringByAppendingString:@"_mine"];
363363
}else{
364364
tempNewKey = newKey;

Coding_iOS/Util/OC_Category/NSString+Common.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ - (CGSize)getSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size{
157157
if (self.length <= 0) {
158158
return resultSize;
159159
}
160-
resultSize = [self boundingRectWithSize:size
160+
resultSize = [self boundingRectWithSize:CGSizeMake(floor(size.width), floor(size.height))//用相对小的 width 去计算 height / 小 heigth 算 width
161161
options:(NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin)
162162
attributes:@{NSFontAttributeName: font}
163163
context:nil].size;
164-
resultSize = CGSizeMake(MIN(size.width, ceilf(resultSize.width)), MIN(size.height, ceilf(resultSize.height)));
164+
resultSize = CGSizeMake(floor(resultSize.width + 1), floor(resultSize.height + 1));//上面用的小 width(height) 来计算了,这里要 +1
165165
return resultSize;
166166
}
167167

0 commit comments

Comments
 (0)