浏览代码

作品发布弹窗交互优化

Steven 5 月之前
父节点
当前提交
36109e2ec8

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -607,7 +607,7 @@
     [self.publishAlert chooseAction:^(PUBLISH_ACTION type) {
         [weakSelf publishAction:type];
     }];
-    [self.publishAlert showAlert];
+    [self.publishAlert showAlertInView:self];
 }
 
 - (void)publishAction:(PUBLISH_ACTION)type {

+ 0 - 6
KulexiuForStudent/KulexiuForStudent/Module/Chat/GroupNotice/View/NoticeEditBodyView.m

@@ -145,12 +145,6 @@
             NSString *limitedText = [currentText substringToIndex:limitCount];
             textView.text = limitedText;
         }
-        if (textView == self.titleView) {
-            self.titleCount.text = [NSString stringWithFormat:@"%zd/25",textView.text.length];
-        }
-        else {
-            self.contentCount.text = [NSString stringWithFormat:@"%zd/200",textView.text.length];
-        }
     }
     [self updateTextViewLineHeight:textView];
 }

+ 4 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/MusicPublicContentView.h

@@ -8,6 +8,8 @@
 #import <UIKit/UIKit.h>
 #import "MusicPubHeader.h"
 
+typedef void(^PublishInputCallback)(BOOL isEdit);
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface MusicPublicContentView : UIView
@@ -24,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)musicContentPubAction:(MusicPublishCallback)callback;
 
+- (void)publishEditCallback:(PublishInputCallback)callback;
+
 + (CGFloat)getViewHeight;
 
 @end

+ 14 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/MusicPublicContentView.m

@@ -19,6 +19,8 @@
 
 @property (nonatomic, copy) MusicPublishCallback callback;
 
+@property (nonatomic, copy) PublishInputCallback editCallback;
+
 @end
 
 @implementation MusicPublicContentView
@@ -42,6 +44,12 @@
     }
 }
 
+- (void)publishEditCallback:(PublishInputCallback)callback {
+    if (callback) {
+        self.editCallback = callback;
+    }
+}
+
 - (IBAction)sureAction:(id)sender {
     if (self.callback) {
         self.callback(PUBLISH_ACTION_PUBLISH);
@@ -55,6 +63,12 @@
 }
 
 #pragma mark   ---- delegate
+- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
+    if (self.editCallback) {
+        self.editCallback(YES);
+    }
+    return YES;
+}
 
 - (void)textViewDidBeginEditing:(UITextView *)textView {
     self.tipsLabel.hidden = YES;

+ 2 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/MusicPublistAlert.h

@@ -26,7 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)chooseAction:(MusicPublishCallback)callback;
 
-- (void)showAlert;
+- (void)showAlertInView:(UIView *)displayView;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 21 - 18
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/MusicPublistAlert.m

@@ -59,15 +59,6 @@
             make.bottom.mas_equalTo(self.scrollView.mas_bottom);
             make.height.mas_equalTo(height);
         }];
-        [self.publishContainView musicContentPubAction:^(PUBLISH_ACTION type) {
-            [weakSelf endEditing:YES];
-            if (type == PUBLISH_ACTION_PUBLISH) {
-                [weakSelf hideAlert];
-            }
-            if (weakSelf.callback) {
-                weakSelf.callback(type);
-            }
-        }];
     }
     else {
         // container
@@ -76,18 +67,30 @@
         [self.publishContainView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.right.top.bottom.mas_equalTo(self.containerView);
         }];
-        [self.publishContainView musicContentPubAction:^(PUBLISH_ACTION type) {
-            [weakSelf endEditing:YES];
-            if (type == PUBLISH_ACTION_PUBLISH) {
-                [weakSelf hideAlert];
-            }
-            if (weakSelf.callback) {
-                weakSelf.callback(type);
-            }
-        }];
     }
+    [self.publishContainView musicContentPubAction:^(PUBLISH_ACTION type) {
+        [weakSelf endEditing:YES];
+        if (type == PUBLISH_ACTION_PUBLISH) {
+            [weakSelf hideAlert];
+        }
+        if (weakSelf.callback) {
+            weakSelf.callback(type);
+        }
+    }];
+    [self.publishContainView publishEditCallback:^(BOOL isEdit) {
+        [weakSelf changeStatus:isEdit];
+    }];
 }
 
+// 编辑状态下调整scroll 是否支持滚动
+- (void)changeStatus:(BOOL)isEdit {
+    if (isEdit) {
+        self.scrollView.scrollEnabled = NO;
+    }
+    else {
+        self.scrollView.scrollEnabled = YES;
+    }
+}
 - (void)evaluateMusicName:(NSString *)musicName userName:(NSString *)userName musicImage:(NSString *)musicImage {
     self.publishContainView.musicName.text = [NSString returnNoNullStringWithString:musicName];
     [self.publishContainView.musicImage sd_setImageWithURL:[NSURL URLWithString:[musicImage getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"pub_music_placeholder"]];