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
+1 -2
View File
@@ -24,8 +24,7 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.navigationController.navigationBar cnSetBackgroundColor:GIGARGB(216, 216, 216, 1)];
//[self.navigationController.navigationBar cnSetBackgroundColor:GIGARGB(216, 216, 216, 1)];
}
+5
View File
@@ -53,5 +53,10 @@
*/
+(BOOL)isPhoneNumber:(NSString*)mobileNumber;
+(NSAttributedString *)stringWithText:(NSString *)title textColor:(UIColor *)color textFont:(UIFont *)font leterSpace:(CGFloat )space;
+(NSString *)convertToJsonData:(NSDictionary *)dict;
+(NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
@end
+69
View File
@@ -171,7 +171,76 @@
return NO;
}
}
+(NSAttributedString *)stringWithText:(NSString *)title textColor:(UIColor *)color textFont:(UIFont *)font leterSpace:(CGFloat )space
{
NSMutableParagraphStyle *paragraStyle = [[NSMutableParagraphStyle alloc] init];
paragraStyle.alignment = NSTextAlignmentCenter;
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color,NSKernAttributeName:@(space),NSParagraphStyleAttributeName:paragraStyle}];
return attributedString;
}
+(NSString *)convertToJsonData:(NSDictionary *)dict
{
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString;
if (!jsonData) {
NSLog(@"%@",error);
}else{
jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
}
NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
NSRange range = {0,jsonString.length};
//去掉字符串中的空格
[mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
NSRange range2 = {0,mutStr.length};
//去掉字符串中的换行符
[mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
return mutStr;
}
+(NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString
{
if (jsonString == nil) {
return nil;
}
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingMutableContainers
error:&err];
if(err)
{
NSLog(@"json解析失败:%@",err);
return nil;
}
return dic;
}
@end
@@ -14,7 +14,6 @@
{
if (self = [super initWithFrame:frame]) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 44)];
//label.textColor = GIGAUIColorFromRGBA(0x777777);
label.textColor = [UIColor whiteColor];
label.text = str;
label.font = [UIFont fontWithName:@"PingFangSC-Medium" size:18.f];