فهرست منبع

添加课程方案按钮

Steven 8 ماه پیش
والد
کامیت
efdeda103b

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MinePageTipsView/MinePageCourseTipsView.xib

@@ -25,9 +25,9 @@
                             </constraints>
                         </view>
                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bLS-om-ATf">
-                            <rect key="frame" x="142.66666666666666" y="156" width="80" height="38"/>
+                            <rect key="frame" x="82.666666666666686" y="156" width="200" height="38"/>
                             <constraints>
-                                <constraint firstAttribute="width" constant="80" id="syR-qq-Uo7"/>
+                                <constraint firstAttribute="width" constant="200" id="m0d-Vc-obz"/>
                             </constraints>
                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                             <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>

+ 5 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/ProgramAddButton.h

@@ -7,16 +7,20 @@
 
 #import <UIKit/UIKit.h>
 
+typedef void(^PraagamAddButtonCallback)(NSInteger buttonIndex);
+
 NS_ASSUME_NONNULL_BEGIN
 
+
 @interface ProgramAddButton : UIView
 
 @property (nonatomic, assign) BOOL isChoose;
 
 - (instancetype)sharedInstance;
 
-- (void)configWithTitle:(NSString *)title nomalBgColor:(UIColor *)nomalBgColor nomalTitleColor:(UIColor *)nomalTitleColor selectedBgColor:(UIColor *)selectedBgColor selectedTitleColor:(UIColor *)selectedTitleColor;
+- (void)configWithTitle:(NSString *)title nomalBgColor:(UIColor *)nomalBgColor nomalTitleColor:(UIColor *)nomalTitleColor selectedBgColor:(UIColor *)selectedBgColor selectedTitleColor:(UIColor *)selectedTitleColor tag:(NSInteger)tagIndex;
 
+- (void)buttonActionCallback:(PraagamAddButtonCallback)callback;
 @end
 
 NS_ASSUME_NONNULL_END

+ 41 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/ProgramAddButton.m

@@ -9,6 +9,10 @@
 
 @interface ProgramAddButton ()
 
+@property (weak, nonatomic) IBOutlet UIView *bgView;
+
+@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
+
 @property (nonatomic, strong) UIColor *nomalBgColor;
 
 @property (nonatomic, strong) UIColor *nomalTitleColor;
@@ -17,6 +21,10 @@
 
 @property (nonatomic, strong) UIColor *selectedTitleColor;
 
+@property (nonatomic, assign) NSInteger buttonIndex;
+
+@property (nonatomic, copy) PraagamAddButtonCallback callback;
+
 @end
 
 @implementation ProgramAddButton
@@ -27,9 +35,41 @@
     return view;
 }
 
-- (void)configWithTitle:(NSString *)title nomalBgColor:(UIColor *)nomalBgColor nomalTitleColor:(UIColor *)nomalTitleColor selectedBgColor:(UIColor *)selectedBgColor selectedTitleColor:(UIColor *)selectedTitleColor {
+- (void)configWithTitle:(NSString *)title nomalBgColor:(UIColor *)nomalBgColor nomalTitleColor:(UIColor *)nomalTitleColor selectedBgColor:(UIColor *)selectedBgColor selectedTitleColor:(UIColor *)selectedTitleColor tag:(NSInteger)tagIndex {
+    self.titleLabel.text = title;
+    self.nomalBgColor = nomalBgColor;
+    self.nomalTitleColor = nomalTitleColor;
+    self.selectedBgColor = selectedBgColor;
+    self.selectedTitleColor = selectedTitleColor;
+    self.buttonIndex = tagIndex;
+}
+
+- (void)buttonActionCallback:(PraagamAddButtonCallback)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+    
+}
+- (IBAction)buttonAction:(id)sender {
+    if (self.callback) {
+        self.callback(self.buttonIndex);
+    }
     
 }
+
+- (void)setIsChoose:(BOOL)isChoose {
+    _isChoose = isChoose;
+    if (isChoose) {
+        self.titleLabel.textColor = self.selectedTitleColor;
+        self.bgView.backgroundColor = self.selectedBgColor;
+        self.bgView.layer.borderColor = self.selectedTitleColor.CGColor;
+    }
+    else {
+        self.titleLabel.textColor = self.nomalTitleColor;
+        self.bgView.backgroundColor = self.nomalBgColor;
+        self.bgView.layer.borderColor = [UIColor clearColor].CGColor;
+    }
+}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 16 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/ProgramAddButton.xib

@@ -9,7 +9,7 @@
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="iN0-l3-epB">
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ProgramAddButton">
             <rect key="frame" x="0.0" y="0.0" width="163" height="49"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
@@ -22,13 +22,24 @@
                             <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W8H-Zm-10g">
+                            <rect key="frame" x="0.0" y="0.0" width="163" height="49"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="buttonAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="YEm-eA-lL7"/>
+                            </connections>
+                        </button>
                     </subviews>
                     <color key="backgroundColor" red="0.97254901960784312" green="0.97254901960784312" blue="0.97254901960784312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     <constraints>
                         <constraint firstItem="UO0-cH-Lkq" firstAttribute="top" secondItem="3km-Oy-8f1" secondAttribute="top" id="6VR-XB-8ie"/>
                         <constraint firstAttribute="trailing" secondItem="UO0-cH-Lkq" secondAttribute="trailing" constant="5" id="6su-q8-RP1"/>
                         <constraint firstAttribute="bottom" secondItem="UO0-cH-Lkq" secondAttribute="bottom" id="92Q-PQ-shC"/>
+                        <constraint firstAttribute="trailing" secondItem="W8H-Zm-10g" secondAttribute="trailing" id="DLi-98-pqc"/>
                         <constraint firstItem="UO0-cH-Lkq" firstAttribute="leading" secondItem="3km-Oy-8f1" secondAttribute="leading" constant="5" id="QnC-US-JqA"/>
+                        <constraint firstAttribute="bottom" secondItem="W8H-Zm-10g" secondAttribute="bottom" id="ZZ6-69-Z60"/>
+                        <constraint firstItem="W8H-Zm-10g" firstAttribute="leading" secondItem="3km-Oy-8f1" secondAttribute="leading" id="qNz-6B-nuB"/>
+                        <constraint firstItem="W8H-Zm-10g" firstAttribute="top" secondItem="3km-Oy-8f1" secondAttribute="top" id="zx5-Nf-ZvM"/>
                     </constraints>
                     <userDefinedRuntimeAttributes>
                         <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
@@ -47,6 +58,10 @@
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="bgView" destination="3km-Oy-8f1" id="h2c-sI-QmT"/>
+                <outlet property="titleLabel" destination="UO0-cH-Lkq" id="6Ia-hA-cCU"/>
+            </connections>
             <point key="canvasLocation" x="-2.2900763358778624" y="104.5774647887324"/>
         </view>
     </objects>