Browse Source

作品发布弹窗交互优化

Steven 9 months ago
parent
commit
28d74076e8

+ 4 - 4
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="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" 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="21207"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -11,7 +11,7 @@
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="AccompanyLoadingView">
             <rect key="frame" x="0.0" y="0.0" width="699" height="340"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cloudLoading_bg" translatesAutoresizingMaskIntoConstraints="NO" id="ZV3-qJ-uxE">
                     <rect key="frame" x="0.0" y="0.0" width="699" height="340"/>
@@ -25,7 +25,7 @@
                     </constraints>
                 </view>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="小酷正在努力加载,请稍等..." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bjn-zM-LJW">
-                    <rect key="frame" x="257.5" y="276" width="184" height="17"/>
+                    <rect key="frame" x="260" y="276" width="179" height="17"/>
                     <fontDescription key="fontDescription" type="system" pointSize="14"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <nil key="highlightedColor"/>

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

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

+ 4 - 0
KulexiuForTeacher/KulexiuForTeacher/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
KulexiuForTeacher/KulexiuForTeacher/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;

+ 8 - 8
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Works/View/MusicPublicContentView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -65,7 +65,7 @@
                             <rect key="frame" x="12" y="47.666666666666657" width="62" height="20"/>
                             <subviews>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="选封面" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dcs-Oi-GdD">
-                                    <rect key="frame" x="11" y="0.0" width="40" height="18"/>
+                                    <rect key="frame" x="11.666666666666664" y="0.0" width="39" height="18"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="18" id="b6r-rS-afy"/>
                                     </constraints>
@@ -142,20 +142,20 @@
                     <rect key="frame" x="12" y="0.0" width="369" height="87"/>
                     <subviews>
                         <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EYP-nq-h0J">
-                            <rect key="frame" x="12" y="0.0" width="345" height="87"/>
+                            <rect key="frame" x="12" y="0.0" width="345" height="63"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             <color key="textColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="calibratedRGB"/>
                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                             <textInputTraits key="textInputTraits" autocapitalizationType="sentences" enablesReturnKeyAutomatically="YES"/>
                         </textView>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我发布了一首演奏作品,快来听听吧~" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="glk-go-0oW">
-                            <rect key="frame" x="12" y="10" width="243" height="17"/>
+                            <rect key="frame" x="11.999999999999986" y="10" width="236.66666666666663" height="17"/>
                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                             <color key="textColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0/150" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lro-Xx-AAz">
-                            <rect key="frame" x="325" y="58" width="32" height="20"/>
+                            <rect key="frame" x="325" y="63" width="32" height="20"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="20" id="83V-tz-Cpg"/>
                             </constraints>
@@ -168,13 +168,13 @@
                     <constraints>
                         <constraint firstItem="glk-go-0oW" firstAttribute="leading" secondItem="NpE-3V-eM1" secondAttribute="leading" constant="12" id="3kw-tz-XVV"/>
                         <constraint firstItem="EYP-nq-h0J" firstAttribute="top" secondItem="NpE-3V-eM1" secondAttribute="top" id="GLb-KA-3Zz"/>
+                        <constraint firstItem="lro-Xx-AAz" firstAttribute="top" secondItem="EYP-nq-h0J" secondAttribute="bottom" id="Lsb-oF-McB"/>
                         <constraint firstAttribute="height" constant="87" id="MM1-lx-Cmu"/>
-                        <constraint firstAttribute="bottom" secondItem="lro-Xx-AAz" secondAttribute="bottom" constant="9" id="c5Y-ih-yEg"/>
+                        <constraint firstAttribute="bottom" secondItem="lro-Xx-AAz" secondAttribute="bottom" constant="4" id="c5Y-ih-yEg"/>
                         <constraint firstItem="EYP-nq-h0J" firstAttribute="leading" secondItem="NpE-3V-eM1" secondAttribute="leading" constant="12" id="erk-lD-qR7"/>
                         <constraint firstItem="glk-go-0oW" firstAttribute="top" secondItem="NpE-3V-eM1" secondAttribute="top" constant="10" id="ncg-6K-1re"/>
                         <constraint firstAttribute="trailing" secondItem="lro-Xx-AAz" secondAttribute="trailing" constant="12" id="sOe-Ih-nSR"/>
                         <constraint firstAttribute="trailing" secondItem="EYP-nq-h0J" secondAttribute="trailing" constant="12" id="tXY-CK-lhd"/>
-                        <constraint firstAttribute="bottom" secondItem="EYP-nq-h0J" secondAttribute="bottom" id="vZM-tS-pb2"/>
                     </constraints>
                     <userDefinedRuntimeAttributes>
                         <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">

+ 2 - 1
KulexiuForTeacher/KulexiuForTeacher/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
KulexiuForTeacher/KulexiuForTeacher/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"]];