This commit is contained in:
lianxiang
2018-09-06 21:19:50 +08:00
parent 17d4481f2c
commit 0f09748cc8
69 changed files with 966 additions and 439 deletions
+16
View File
@@ -0,0 +1,16 @@
//
// NSString+Unicode.h
// GIGA
//
// Created by lianxiang on 2018/9/6.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (Unicode)
- (NSString *)replaceUnicode:(NSString *)unicodeStr;
- (NSString *)htmlEntityDecode:(NSString *)string;
@end
+39
View File
@@ -0,0 +1,39 @@
//
// NSString+Unicode.m
// GIGA
//
// Created by lianxiang on 2018/9/6.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "NSString+Unicode.h"
@implementation NSString (Unicode)
- (NSString *)replaceUnicode:(NSString *)unicodeStr {
NSString *tempStr1 = [unicodeStr stringByReplacingOccurrencesOfString:@"\\u"withString:@"\\U"];
NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\""withString:@"\\\""];
NSString *tempStr3 = [[@"\""stringByAppendingString:tempStr2]stringByAppendingString:@"\""];
NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
NSString* returnStr = [NSPropertyListSerialization propertyListFromData:tempData
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:NULL];
return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n"withString:@"\n"];
}
//将 &lt 等类似的字符转化为HTML中的“<”等
- (NSString *)htmlEntityDecode:(NSString *)string
{
string = [string stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
string = [string stringByReplacingOccurrencesOfString:@"&apos;" withString:@"'"];
string = [string stringByReplacingOccurrencesOfString:@"&lt;" withString:@"<"];
string = [string stringByReplacingOccurrencesOfString:@"&gt;" withString:@">"];
string = [string stringByReplacingOccurrencesOfString:@"&amp;" withString:@"&"]; // Do this last so that, e.g. @"&amp;lt;" goes to @"&lt;" not @"<"
return string;
}
@end
+1 -1
View File
@@ -26,7 +26,7 @@ static char overlayKey;
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -PhoneX_STATUBAR_H, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + PhoneX_STATUBAR_H)];
self.overlay.userInteractionEnabled = NO;
//self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self insertSubview:self.overlay atIndex:0];
}