fix
This commit is contained in:
@@ -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
|
||||
@@ -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"];
|
||||
}
|
||||
|
||||
//将 < 等类似的字符转化为HTML中的“<”等
|
||||
- (NSString *)htmlEntityDecode:(NSString *)string
|
||||
{
|
||||
string = [string stringByReplacingOccurrencesOfString:@""" withString:@"\""];
|
||||
string = [string stringByReplacingOccurrencesOfString:@"'" withString:@"'"];
|
||||
string = [string stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
|
||||
string = [string stringByReplacingOccurrencesOfString:@">" withString:@">"];
|
||||
string = [string stringByReplacingOccurrencesOfString:@"&" withString:@"&"]; // Do this last so that, e.g. @"&lt;" goes to @"<" not @"<"
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user