-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new TextFieldTableViewCell that uses a dynamic font.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
- Loading branch information
Showing
8 changed files
with
67 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
import UIKit | ||
|
||
let textFieldCellIdentifier = "textFieldCellIdentifier" | ||
|
||
class TextFieldTableViewCell: UITableViewCell { | ||
|
||
let textField: UITextField = { | ||
let textField = UITextField() | ||
textField.translatesAutoresizingMaskIntoConstraints = false | ||
textField.font = UIFont.preferredFont(forTextStyle: .body) | ||
textField.adjustsFontForContentSizeCategory = true | ||
textField.clearButtonMode = .whileEditing | ||
textField.returnKeyType = .done | ||
return textField | ||
}() | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
|
||
contentView.addSubview(textField) | ||
|
||
NSLayoutConstraint.activate([ | ||
textField.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 10), | ||
textField.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -10), | ||
textField.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16), | ||
textField.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16) | ||
]) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
|
||
textField.text = "" | ||
textField.placeholder = nil | ||
textField.keyboardType = .default | ||
textField.autocorrectionType = .no | ||
textField.autocapitalizationType = .none | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.