瀏覽代碼

进度条loading样式优化

Steven 9 月之前
父節點
當前提交
affcb2016f

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyWebView/AccompanyLoadingView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 15 - 4
KulexiuForTeacher/KulexiuForTeacher/Common/Base/WebView/KSBaseWKWebViewController.m

@@ -1569,7 +1569,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         if (!_HUD) {
             _HUD = [MBProgressHUD showHUDAddedTo:keyWindow animated:YES];
             _HUD.mode = MBProgressHUDModeDeterminateHorizontalBar;
-            _HUD.label.text = @"正在上传视频...";
+            _HUD.label.attributedText = [self getAttrStringWithText:@"正在上传视频文件..."];
             _HUD.contentColor = [UIColor whiteColor];
             _HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
             _HUD.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
@@ -1585,6 +1585,17 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     }
 }
 
+- (NSMutableAttributedString *)getAttrStringWithText:(NSString *)text {
+    if (![NSString isEmptyString:text]) {
+        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+        [paragraphStyle setLineSpacing:6];//调整行间距
+        NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:HexRGB(0xffffff)}];
+        return attr;
+    }
+    else {
+        return [[NSMutableAttributedString alloc] initWithString:@""];
+    }
+}
 - (void)uploadImageArray:(NSMutableArray *)imageArray bucket:(NSString *)bucket {
     [LOADING_MANAGER showHUD];
     NSMutableArray *imageDataArray = [NSMutableArray array];
@@ -1593,7 +1604,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [imageDataArray addObject:imgData];
     }
     [UPLOAD_MANAGER configWithfilePath:@"/user/"];
-    [[KSUploadManager shareInstance] mutilUploadImage:imageDataArray fileName:@"complainImg" successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+    [UPLOAD_MANAGER mutilUploadImage:imageDataArray fileName:@"complainImg" successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
         [LOADING_MANAGER removeHUD];
         NSMutableArray *urlArray = [NSMutableArray array];
         for (NSString *url in fileUrlArray) {
@@ -1623,7 +1634,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         NSData *imgData = [UIImage turnsImaegDataByImage:previewImage];
         NSString *fileName = @"videoPreviewImg";
         [UPLOAD_MANAGER configWithfilePath:@"klx"];
-        [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+        [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
             NSString *url = [fileUrlArray lastObject];
             imageUrl = url;
             [self submitUrlWith:imageUrl videoUrl:videoUrl];
@@ -1645,7 +1656,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     NSURL *uploadFileUrl = [NSURL fileURLWithPath:videoUrl];
     NSData *fileData = [NSData dataWithContentsOfURL:uploadFileUrl];
     NSString *suffix = [NSString stringWithFormat:@".%@",[uploadFileUrl pathExtension]];
-    [[KSUploadManager shareInstance] videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
+    [UPLOAD_MANAGER videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
         dispatch_main_async_safe(^{
             // 显示进度
             if (self.HUD) {

+ 1 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/LoadingManager/KSHudLoagingManager.m

@@ -135,7 +135,7 @@
     [self removeLoadingView];
     self.HUD = [MBProgressHUD showHUDAddedTo:[NSObject getKeyWindow] animated:YES];
     self.HUD.mode = MBProgressHUDModeDeterminateHorizontalBar;
-    self.HUD.label.text = text;
+    self.HUD.label.attributedText = [self getAttrStringWithText:text];
     self.HUD.contentColor = [UIColor whiteColor];
     self.HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
     self.HUD.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8f);
@@ -227,7 +227,6 @@
 
 - (void)removeProgressLoadingNoDelay {
     [self.progressLoading hideLoadingView];
-
 }
 
 // 进度loading后续操作

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Custom/KSMediaManager.m

@@ -192,7 +192,7 @@
             
             [[TZImageManager manager] getVideoOutputPathWithAsset:asset presetName:self.presentName success:^(NSString *outputPath) {
                 dispatch_main_sync_safe(^{
-                    [LOADING_MANAGER removeHUD];
+                    [LOADING_MANAGER removeHUDNoDelay];
                 });
                 NSLog(@"视频导出到本地完成,沙盒路径为:%@",outputPath);
                 NSData *outputData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:outputPath]]; //压缩后的视频
@@ -207,7 +207,7 @@
                 
             } failure:^(NSString *errorMessage, NSError *error) {
                 dispatch_main_sync_safe(^{
-                    [LOADING_MANAGER removeHUD];
+                    [LOADING_MANAGER removeHUDNoDelay];
                     [LOADING_MANAGER MBShowAUTOHidingInWindow:@"视频导出失败"];
                 });
                 NSLog(@"视频导出失败:%@,error:%@",errorMessage, error);

+ 15 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m

@@ -426,7 +426,7 @@
             NSData *imgData = [UIImage compressImage:firstImage maxLength:5];
             NSString *fileName = @"styleImage";
             [UPLOAD_MANAGER configWithfilePath:@"/user/"];
-            [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+            [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
                 NSString *imageUrl = [fileUrlArray lastObject];
                 [self uploadVideoWithUrl:videoUrl coverUrl:imageUrl];
                 
@@ -452,7 +452,7 @@
     NSData *fileData = [NSData dataWithContentsOfURL:fileUrl];
     NSString *suffix = [NSString stringWithFormat:@".%@",[fileUrl pathExtension]];
     [UPLOAD_MANAGER configWithfilePath:@"/user/"];
-    [[KSUploadManager shareInstance] videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
+    [UPLOAD_MANAGER videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
         dispatch_main_async_safe(^{
             // 显示进度
             if (self.HUD) {
@@ -637,7 +637,7 @@
             _HUD = [MBProgressHUD showHUDAddedTo:keyWindow animated:YES];
             _HUD.removeFromSuperViewOnHide = YES;
             _HUD.mode = MBProgressHUDModeDeterminateHorizontalBar;
-            _HUD.label.text = @"正在上传视频文件...";
+            _HUD.label.attributedText = [self getAttrStringWithText:@"正在上传视频文件..."];
             _HUD.contentColor = [UIColor whiteColor];
             _HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
             _HUD.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
@@ -651,6 +651,17 @@
     }
 }
 
+- (NSMutableAttributedString *)getAttrStringWithText:(NSString *)text {
+    if (![NSString isEmptyString:text]) {
+        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+        [paragraphStyle setLineSpacing:6];//调整行间距
+        NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:HexRGB(0xffffff)}];
+        return attr;
+    }
+    else {
+        return [[NSMutableAttributedString alloc] initWithString:@""];
+    }
+}
 
 - (MyStyleEditHeadView *)infoHeadView {
     if (!_infoHeadView) {
@@ -727,7 +738,7 @@
     NSData *imgData = [UIImage turnsImaegDataByImage:image];
     NSString *fileName = @"image";
     [UPLOAD_MANAGER configWithfilePath:@"/user/"];
-    [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+    [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
         NSString *avatarUrl = [fileUrlArray lastObject];
         [self modifyUserMessage:avatarUrl gender:nil];
     } faliure:^(NSError * _Nullable error, NSString *descMessaeg) {

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/UserSettingViewController.m

@@ -196,7 +196,7 @@
     NSData *imgData = [UIImage turnsImaegDataByImage:image];
     NSString *fileName = @"image";
     [UPLOAD_MANAGER configWithfilePath:@"/user/"];
-    [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+    [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
         NSString *avatarUrl = [fileUrlArray lastObject];
         [self modifyUserMessage:avatarUrl gender:nil];
     } faliure:^(NSError * _Nullable error, NSString *descMessaeg) {