mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-24 04:06:48 +10:00
set leftTextInset & rightTextInset in BorderTextField
This commit is contained in:
@@ -191,7 +191,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" horizontalCompressionResistancePriority="749" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="86" placeholder=" " textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rD8-Pa-pw2" customClass="BorderTextField" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="198" width="49" height="60"/>
|
||||
<rect key="frame" x="0.0" y="198" width="77" height="60"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="Uzt-dE-3IR"/>
|
||||
@@ -203,10 +203,13 @@
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="horizontalInset">
|
||||
<real key="value" value="12"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="leftTextInset">
|
||||
<real key="value" value="32"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</textField>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Mobile" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BMl-2s-Pwj" customClass="BorderTextField" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="49" y="198" width="551" height="60"/>
|
||||
<rect key="frame" x="77" y="198" width="523" height="60"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="120" id="5y7-kD-E2s"/>
|
||||
@@ -219,7 +222,7 @@
|
||||
</userDefinedRuntimeAttributes>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="+" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HUR-xX-H68">
|
||||
<rect key="frame" x="0.0" y="216" width="12" height="21"/>
|
||||
<rect key="frame" x="20" y="216" width="12" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" name="Helvetica-Light" family="Helvetica" pointSize="18"/>
|
||||
<color key="textColor" red="0.0" green="0.50196081399917603" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
@@ -249,7 +252,7 @@
|
||||
<constraints>
|
||||
<constraint firstItem="HUR-xX-H68" firstAttribute="centerY" secondItem="rD8-Pa-pw2" secondAttribute="centerY" constant="-2" id="4no-d2-sd9"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BMl-2s-Pwj" secondAttribute="trailing" id="7Zo-cc-O9q"/>
|
||||
<constraint firstItem="HUR-xX-H68" firstAttribute="leading" secondItem="rD8-Pa-pw2" secondAttribute="leading" id="9Hu-eE-gXe"/>
|
||||
<constraint firstItem="HUR-xX-H68" firstAttribute="leading" secondItem="rD8-Pa-pw2" secondAttribute="leading" constant="20" id="9Hu-eE-gXe"/>
|
||||
<constraint firstItem="BMl-2s-Pwj" firstAttribute="centerY" secondItem="rD8-Pa-pw2" secondAttribute="centerY" id="AhX-AW-EMN"/>
|
||||
<constraint firstItem="BMl-2s-Pwj" firstAttribute="height" secondItem="rD8-Pa-pw2" secondAttribute="height" id="HTY-ZH-iuw"/>
|
||||
<constraint firstItem="BMl-2s-Pwj" firstAttribute="leading" secondItem="rD8-Pa-pw2" secondAttribute="trailing" id="O8c-r9-B6w"/>
|
||||
|
||||
@@ -19,7 +19,8 @@ class BorderTextField: UITextField {
|
||||
@IBInspectable var enabledBottomLine: Bool = true
|
||||
@IBInspectable var enabledRightLine: Bool = false
|
||||
|
||||
@IBInspectable var horizontalInset: CGFloat = 20
|
||||
@IBInspectable var leftTextInset: CGFloat = 20
|
||||
@IBInspectable var rightTextInset: CGFloat = 20
|
||||
|
||||
override func drawRect(rect: CGRect) {
|
||||
super.drawRect(rect)
|
||||
@@ -60,7 +61,7 @@ class BorderTextField: UITextField {
|
||||
}
|
||||
|
||||
override func textRectForBounds(bounds: CGRect) -> CGRect {
|
||||
return CGRectInset(bounds, horizontalInset, 0)
|
||||
return CGRect(x: leftTextInset, y: 0, width: bounds.width - leftTextInset - rightTextInset, height: bounds.height)
|
||||
}
|
||||
|
||||
override func editingRectForBounds(bounds: CGRect) -> CGRect {
|
||||
|
||||
Reference in New Issue
Block a user