Skip to content

Commit 3034f56

Browse files
committed
🐛 修复搜索框文字高度问题
1 parent 72b7064 commit 3034f56

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Mac/Base.lproj/Main.storyboard

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
66
<capability name="Named colors" minToolsVersion="9.0"/>
77
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
88
</dependencies>

Mac/View/SearchTextField.swift

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class SearchTextField: NSSearchField, NSSearchFieldDelegate {
1818

1919
private var trackingArea: NSTrackingArea?
2020

21+
22+
override func rectForSearchText(whenCentered isCentered: Bool) -> NSRect {
23+
var rect = super.rectForSearchText(whenCentered: isCentered)
24+
rect.origin.y += 1.0
25+
rect.size.height += 2.0
26+
return rect
27+
}
28+
2129
override func updateTrackingAreas() {
2230
if let trackingArea = trackingArea {
2331
removeTrackingArea(trackingArea)

0 commit comments

Comments
 (0)