Browse Source

【组件库】KMDesignSelect 文字居中调整

lizhe 1 year ago
parent
commit
d1b449eff3

+ 2 - 1
PDF Office/PDF Master/Class/Home/ViewController/customViewController/KMDesignSelect.swift

@@ -34,9 +34,10 @@ class KMSelectCell: NSTextFieldCell {
 //            newRect.size.height = textSize.height
 //            newRect.origin.y += heightDelta
 //        }
+        let originY = ((self.controlView?.bounds.size.height)! - textSize.height) / 2
 
         newRect.size.height = textSize.height
-        newRect.origin.y += 3.0
+        newRect.origin.y += originY
         newRect.origin.x += offset
         newRect.size.width = theRect.width - offset*2
 //        newRect.fill()

+ 5 - 6
PDF Office/PDF Master/Class/Home/ViewController/customViewController/KMDesignSelect.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMDesignSelect" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMDesignSelect" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="horizontalPadding_spacing" destination="zXq-bs-uyE" id="lj0-Ik-ovU"/>
                 <outlet property="imageView" destination="pY7-Ye-k9N" id="gmc-pp-NfK"/>
@@ -25,7 +24,7 @@
             <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
-                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Xk1-7q-unw" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Xk1-7q-unw" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
                     <view key="contentView" id="WPX-6N-vCM">
                         <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
@@ -50,7 +49,7 @@
                 <subviews>
                     <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aHg-43-XTf">
                         <rect key="frame" x="0.0" y="0.0" width="287" height="21"/>
-                        <textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="c66-BA-jKX" customClass="KMSelectCell" customModule="PDF_Office" customModuleProvider="target">
+                        <textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="c66-BA-jKX" customClass="KMSelectCell" customModule="PDF_Master" customModuleProvider="target">
                             <font key="font" usesAppearanceFont="YES"/>
                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>