Explorar o código

输入时空字符串处理

Steven hai 1 mes
pai
achega
81de29ac49

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/GroupNotice/Controller/GroupNoticeEditController.m

@@ -38,7 +38,9 @@
     }];
     if (_isModify) {
         self.bodyView.titleView.text = [NSString returnNoNullStringWithString:self.titles];
+        self.bodyView.titleCount.text = [NSString stringWithFormat:@"%zd/25",self.titles.length];
         self.bodyView.contentArea.text = [NSString returnNoNullStringWithString:self.content];
+        self.bodyView.contentCount.text = [NSString stringWithFormat:@"%zd/200",self.content.length];
        self.bodyView.topTipsLabel.hidden = [NSString isEmptyString:self.titles] ? NO : YES;
         self.bodyView.tipsLabel.hidden = [NSString isEmptyString:self.content] ? NO : YES;
         self.bodyView.isOn = self.isOn;

+ 14 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/GroupNotice/View/GroupNoticeCell.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -34,7 +34,7 @@
                                 </userDefinedRuntimeAttributes>
                             </imageView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="陈老师" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2c3-yX-YxS">
-                                <rect key="frame" x="70" y="14" width="207.5" height="22"/>
+                                <rect key="frame" x="70" y="14" width="48" height="22"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="22" id="dMw-tJ-YFP"/>
                                 </constraints>
@@ -105,10 +105,16 @@
                                 <color key="textColor" red="0.46666666666666667" green="0.46666666666666667" blue="0.46666666666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
+                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="group_role_teacher" translatesAutoresizingMaskIntoConstraints="NO" id="jeh-rq-RTe">
+                                <rect key="frame" x="122" y="15" width="41" height="20"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="41" id="Iax-kU-PeB"/>
+                                    <constraint firstAttribute="height" constant="20" id="zJl-62-HRO"/>
+                                </constraints>
+                            </imageView>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
-                            <constraint firstItem="Gv9-px-E4j" firstAttribute="leading" secondItem="2c3-yX-YxS" secondAttribute="trailing" constant="12" id="0d1-2V-f0c"/>
                             <constraint firstItem="vad-UL-yLE" firstAttribute="top" secondItem="2c3-yX-YxS" secondAttribute="bottom" constant="4" id="1f7-zg-Ca8"/>
                             <constraint firstItem="Gkn-L8-UCb" firstAttribute="leading" secondItem="Jdh-Fo-Wpn" secondAttribute="leading" constant="12" id="3ZI-Dn-gaU"/>
                             <constraint firstItem="vad-UL-yLE" firstAttribute="leading" secondItem="2c3-yX-YxS" secondAttribute="leading" id="42C-LT-gAz"/>
@@ -119,6 +125,7 @@
                             <constraint firstItem="Fse-Bd-Rui" firstAttribute="leading" secondItem="vad-UL-yLE" secondAttribute="trailing" constant="6" id="Oss-CV-BSR"/>
                             <constraint firstItem="2c3-yX-YxS" firstAttribute="top" secondItem="Jdh-Fo-Wpn" secondAttribute="top" constant="14" id="P5L-2G-u6a"/>
                             <constraint firstItem="Gv9-px-E4j" firstAttribute="top" secondItem="Jdh-Fo-Wpn" secondAttribute="top" constant="5.5" id="QXL-oK-dMf"/>
+                            <constraint firstItem="jeh-rq-RTe" firstAttribute="leading" secondItem="2c3-yX-YxS" secondAttribute="trailing" constant="4" id="SHE-iy-OOp"/>
                             <constraint firstItem="gxd-9e-9Xw" firstAttribute="top" secondItem="47L-aP-812" secondAttribute="bottom" constant="12" id="V1V-pl-ind"/>
                             <constraint firstItem="Gkn-L8-UCb" firstAttribute="top" secondItem="Jdh-Fo-Wpn" secondAttribute="top" constant="12" id="aQo-eC-AFc"/>
                             <constraint firstItem="FWq-QF-ONl" firstAttribute="top" secondItem="gxd-9e-9Xw" secondAttribute="bottom" constant="5" id="cRa-gO-pGN"/>
@@ -127,7 +134,9 @@
                             <constraint firstItem="47L-aP-812" firstAttribute="leading" secondItem="Jdh-Fo-Wpn" secondAttribute="leading" constant="12" id="eRE-Hj-7oe"/>
                             <constraint firstAttribute="bottom" secondItem="FWq-QF-ONl" secondAttribute="bottom" constant="16" id="gKg-yF-TE1"/>
                             <constraint firstItem="47L-aP-812" firstAttribute="top" secondItem="Gkn-L8-UCb" secondAttribute="bottom" constant="12" id="oji-Pv-sfT"/>
+                            <constraint firstItem="Gv9-px-E4j" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="jeh-rq-RTe" secondAttribute="trailing" constant="10" id="qzK-Ih-eNj"/>
                             <constraint firstAttribute="trailing" secondItem="Gv9-px-E4j" secondAttribute="trailing" constant="3.5" id="upH-rK-Lrc"/>
+                            <constraint firstItem="jeh-rq-RTe" firstAttribute="centerY" secondItem="2c3-yX-YxS" secondAttribute="centerY" id="veJ-tV-WCZ"/>
                             <constraint firstItem="2c3-yX-YxS" firstAttribute="leading" secondItem="Gkn-L8-UCb" secondAttribute="trailing" constant="10" id="xyi-iI-XSB"/>
                         </constraints>
                         <userDefinedRuntimeAttributes>
@@ -159,6 +168,7 @@
         </tableViewCell>
     </objects>
     <resources>
+        <image name="group_role_teacher" width="41" height="20"/>
         <image name="notice_action" width="24" height="25"/>
         <image name="teacher_avatar" width="150" height="150"/>
         <systemColor name="systemBackgroundColor">

+ 14 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/GroupNotice/View/GroupNoticeDetailBodyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina6_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -31,7 +31,7 @@
                             </userDefinedRuntimeAttributes>
                         </imageView>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="70t-nX-m7j">
-                            <rect key="frame" x="69.999999999999986" y="14" width="243.66666666666663" height="22"/>
+                            <rect key="frame" x="70" y="14" width="0.0" height="22"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="22" id="Oto-pk-Eo6"/>
                             </constraints>
@@ -102,10 +102,19 @@
                             <color key="textColor" red="0.46666666666666667" green="0.46666666666666667" blue="0.46666666666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="group_role_teacher" translatesAutoresizingMaskIntoConstraints="NO" id="O8d-wC-pGf">
+                            <rect key="frame" x="74" y="15" width="41" height="20"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="41" id="78G-tQ-ThY"/>
+                                <constraint firstAttribute="height" constant="20" id="ASD-yn-vv0"/>
+                            </constraints>
+                        </imageView>
                     </subviews>
                     <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                     <constraints>
+                        <constraint firstItem="r31-Oy-hyD" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="O8d-wC-pGf" secondAttribute="trailing" constant="10" id="0rn-YV-x5t"/>
                         <constraint firstItem="62c-65-fwx" firstAttribute="top" secondItem="U45-g3-TEP" secondAttribute="top" constant="12" id="95n-hq-uux"/>
+                        <constraint firstItem="O8d-wC-pGf" firstAttribute="leading" secondItem="70t-nX-m7j" secondAttribute="trailing" constant="4" id="B5c-yI-te8"/>
                         <constraint firstAttribute="trailing" secondItem="6Xh-iI-Zl8" secondAttribute="trailing" constant="12" id="CDd-eV-WJh"/>
                         <constraint firstItem="70t-nX-m7j" firstAttribute="top" secondItem="U45-g3-TEP" secondAttribute="top" constant="14" id="DzK-hi-wVo"/>
                         <constraint firstItem="I5b-RG-0dE" firstAttribute="top" secondItem="70t-nX-m7j" secondAttribute="bottom" constant="4" id="Fc4-dB-leq"/>
@@ -117,9 +126,9 @@
                         <constraint firstItem="6Xh-iI-Zl8" firstAttribute="top" secondItem="NH8-Zj-ieK" secondAttribute="bottom" constant="12" id="Wfw-w5-jaS"/>
                         <constraint firstAttribute="trailing" secondItem="RUn-oI-u4C" secondAttribute="trailing" constant="23" id="ZZY-7F-NSz"/>
                         <constraint firstAttribute="bottom" secondItem="RUn-oI-u4C" secondAttribute="bottom" constant="16" id="ewD-oI-JY8"/>
+                        <constraint firstItem="O8d-wC-pGf" firstAttribute="centerY" secondItem="70t-nX-m7j" secondAttribute="centerY" id="hvU-bl-4JU"/>
                         <constraint firstItem="g5H-XJ-LiA" firstAttribute="leading" secondItem="I5b-RG-0dE" secondAttribute="trailing" constant="6" id="jIe-U3-gnt"/>
                         <constraint firstItem="70t-nX-m7j" firstAttribute="leading" secondItem="62c-65-fwx" secondAttribute="trailing" constant="10" id="lhs-RK-8UB"/>
-                        <constraint firstItem="r31-Oy-hyD" firstAttribute="leading" secondItem="70t-nX-m7j" secondAttribute="trailing" constant="10" id="lke-VY-HYi"/>
                         <constraint firstItem="NH8-Zj-ieK" firstAttribute="top" secondItem="62c-65-fwx" secondAttribute="bottom" constant="12" id="oEx-Li-k9L"/>
                         <constraint firstItem="62c-65-fwx" firstAttribute="leading" secondItem="U45-g3-TEP" secondAttribute="leading" constant="12" id="rCc-3u-NH1"/>
                         <constraint firstItem="6Xh-iI-Zl8" firstAttribute="leading" secondItem="U45-g3-TEP" secondAttribute="leading" constant="12" id="ro4-MV-ZGq"/>
@@ -157,6 +166,7 @@
         </view>
     </objects>
     <resources>
+        <image name="group_role_teacher" width="41" height="20"/>
         <image name="notice_action" width="24" height="25"/>
         <image name="teacher_avatar" width="150" height="150"/>
         <systemColor name="systemBackgroundColor">

+ 0 - 3
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/GroupNotice/View/NoticeEditBodyView.m

@@ -88,9 +88,6 @@
 }
 
 - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
-    if ([text isEqualToString:@""]) {
-        return YES;
-    }
     if (textView == self.titleView) {
         NSString *newText = [[textView text] stringByReplacingCharactersInRange:range withString:text];
         if (newText.length > 25) {

+ 0 - 5
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/View/TenantGroupCreate/TenantCreateGroupBodyView.m

@@ -128,11 +128,6 @@
 }
 
 - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
-
-    if ([text isEqualToString:@""]) {
-        return YES;
-    }
-    
     // 输入控制
     NSString *newString = [textView.text stringByReplacingCharactersInRange:range withString:text];
     if (newString.length > 500) {

+ 0 - 3
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Feedback/View/FeedbackBodyView.m

@@ -104,9 +104,6 @@
         [self endEditing:YES];
         return YES;
     }
-    if ([text isEqualToString:@""]) {
-        return YES;
-    }
     return YES;
 }
 

+ 0 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/View/UnbindView/TenantUnbindBodyView.m

@@ -74,10 +74,6 @@
 }
 
 - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
-
-    if ([text isEqualToString:@""]) {
-        return YES;
-    }
     // 输入控制
     NSString *newString = [textView.text stringByReplacingCharactersInRange:range withString:text];
     if (newString.length > 200) {