Просмотр исходного кода

课程类型提示弹窗点击空白消失

Steven 8 месяцев назад
Родитель
Сommit
9b97dfaa11

+ 17 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/CourseGroupAlertView/CourseDescAlertView.m

@@ -10,7 +10,9 @@
 #import "TYPageControl.h"
 #import "CourseDescAlertCell.h"
 
-@interface CourseDescAlertView ()<TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
+@interface CourseDescAlertView ()<TYCyclePagerViewDataSource,TYCyclePagerViewDelegate,UIGestureRecognizerDelegate>
+
+@property (weak, nonatomic) IBOutlet UIView *bgView;
 
 @property (weak, nonatomic) IBOutlet UIView *containerView;
 
@@ -40,6 +42,20 @@
         make.height.mas_equalTo(12);
         make.bottom.mas_equalTo(self.containerView.mas_bottom).offset(-24);
     }];
+    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
+    tapGesture.delegate = self;
+    [self addGestureRecognizer:tapGesture];
+}
+
+- (void)tapAction:(UITapGestureRecognizer *)gesture {
+    [self removeFromSuperview];
+}
+
+- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
+    if ([touch.view isDescendantOfView:self.bgView]) {
+        return NO;
+    }
+    return YES;
 }
 
 + (instancetype)sharedInstance {

+ 3 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/CourseGroupAlertView/CourseDescAlertView.xib

@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="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_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
-        <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"/>
     </dependencies>
@@ -13,7 +12,7 @@
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="CourseDescAlertView">
             <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="azl-Ae-oTb">
                     <rect key="frame" x="46.666666666666657" y="174" width="300" height="504"/>
@@ -92,7 +91,6 @@
                     </userDefinedRuntimeAttributes>
                 </view>
             </subviews>
-            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
             <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
             <constraints>
                 <constraint firstItem="azl-Ae-oTb" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="QUM-nk-6Do"/>
@@ -102,6 +100,7 @@
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
+                <outlet property="bgView" destination="azl-Ae-oTb" id="7fN-kS-X21"/>
                 <outlet property="containerView" destination="cqL-gu-egq" id="CoO-5Y-KgI"/>
             </connections>
             <point key="canvasLocation" x="23.664122137404579" y="19.718309859154932"/>