mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-03 04:22:43 +08:00
[fix] adapt iOS keyboard switch widths to localized text
This commit is contained in:
@@ -323,6 +323,7 @@ final class RemoteKeyboardInputBar: UIView {
|
|||||||
let computerButton = UIButton(type: .system)
|
let computerButton = UIButton(type: .system)
|
||||||
computerButton.setTitle(NSLocalizedString("电脑键盘", comment: ""), for: .normal)
|
computerButton.setTitle(NSLocalizedString("电脑键盘", comment: ""), for: .normal)
|
||||||
computerButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .medium)
|
computerButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .medium)
|
||||||
|
computerButton.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
computerButton.accessibilityLabel = NSLocalizedString("切换到电脑键盘", comment: "")
|
computerButton.accessibilityLabel = NSLocalizedString("切换到电脑键盘", comment: "")
|
||||||
computerButton.addTarget(self, action: #selector(switchToComputer), for: .touchUpInside)
|
computerButton.addTarget(self, action: #selector(switchToComputer), for: .touchUpInside)
|
||||||
|
|
||||||
@@ -337,7 +338,8 @@ final class RemoteKeyboardInputBar: UIView {
|
|||||||
row.translatesAutoresizingMaskIntoConstraints = false
|
row.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(row)
|
addSubview(row)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
computerButton.widthAnchor.constraint(equalToConstant: 80),
|
// Keep the minimum touch width while allowing longer translations.
|
||||||
|
computerButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 80),
|
||||||
dismissButton.widthAnchor.constraint(equalToConstant: RemoteKeyboardDismissButton.sideLength),
|
dismissButton.widthAnchor.constraint(equalToConstant: RemoteKeyboardDismissButton.sideLength),
|
||||||
row.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 4),
|
row.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 4),
|
||||||
row.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -4),
|
row.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -4),
|
||||||
|
|||||||
@@ -855,7 +855,8 @@ private struct RemoteComputerKeyboard: View {
|
|||||||
switchKeyboard()
|
switchKeyboard()
|
||||||
}
|
}
|
||||||
.font(.system(size: 15, weight: .medium))
|
.font(.system(size: 15, weight: .medium))
|
||||||
.frame(width: 80, height: 44)
|
.fixedSize(horizontal: true, vertical: false)
|
||||||
|
.frame(minWidth: 80, minHeight: 44)
|
||||||
.accessibilityLabel(NSLocalizedString("切换到系统键盘", comment: ""))
|
.accessibilityLabel(NSLocalizedString("切换到系统键盘", comment: ""))
|
||||||
if verticalSizeClass == .compact {
|
if verticalSizeClass == .compact {
|
||||||
pageTabs
|
pageTabs
|
||||||
|
|||||||
Reference in New Issue
Block a user