-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1842 from nextcloud/use-default-cell-for-user-pro…
…file-cell Use default UITableViewCell for user profile cell
- Loading branch information
Showing
6 changed files
with
136 additions
and
196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
import UIKit | ||
|
||
class SettingsTableViewCell: UITableViewCell { | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
commonInit() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
commonInit() | ||
} | ||
|
||
private func commonInit() { | ||
textLabel?.numberOfLines = 0 | ||
detailTextLabel?.numberOfLines = 0 | ||
detailTextLabel?.textColor = .secondaryLabel | ||
} | ||
|
||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
|
||
textLabel?.text = nil | ||
detailTextLabel?.text = nil | ||
imageView?.image = nil | ||
accessoryView = nil | ||
accessoryType = .none | ||
selectionStyle = .default | ||
} | ||
|
||
func setSettingsImage(image: UIImage?, renderingMode: UIImage.RenderingMode = .alwaysTemplate) { | ||
// Render all images to a size of 20x20 so all cells have the same width for the imageView | ||
self.imageView?.image = NCUtils.renderAspectImage(image: image, ofSize: .init(width: 20, height: 20), centerImage: true)?.withRenderingMode(renderingMode) | ||
self.imageView?.tintColor = .secondaryLabel | ||
self.imageView?.contentMode = .scaleAspectFit | ||
} | ||
} |
Oops, something went wrong.