mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Added disclosure indicators.
This commit is contained in:
@@ -13,6 +13,8 @@ import RSTree
|
||||
|
||||
class MasterTableViewCell : UITableViewCell {
|
||||
|
||||
private var accessoryButton: UIButton?
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
set {}
|
||||
get {
|
||||
@@ -102,15 +104,36 @@ class MasterTableViewCell : UITableViewCell {
|
||||
layoutWith(layout)
|
||||
}
|
||||
|
||||
@objc func buttonPressed(_ sender: UIButton) {
|
||||
|
||||
if sender.imageView?.image == AppAssets.chevronRightImage {
|
||||
sender.setImage(AppAssets.chevronDownImage, for: .normal)
|
||||
} else {
|
||||
sender.setImage(AppAssets.chevronRightImage, for: .normal)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private extension MasterTableViewCell {
|
||||
|
||||
func commonInit() {
|
||||
addAccessoryView()
|
||||
addSubviewAtInit(unreadCountView)
|
||||
addSubviewAtInit(faviconImageView)
|
||||
addSubviewAtInit(titleView)
|
||||
}
|
||||
|
||||
func addAccessoryView() {
|
||||
let button = UIButton(type: .roundedRect)
|
||||
button.frame = CGRect(x: 0, y: 0, width: 15.0, height: 15.0)
|
||||
button.setImage(AppAssets.chevronRightImage, for: .normal)
|
||||
button.tintColor = AppAssets.chevronDisclosureColor
|
||||
button.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside)
|
||||
accessoryButton = button
|
||||
accessoryView = button
|
||||
}
|
||||
|
||||
func addSubviewAtInit(_ view: UIView) {
|
||||
addSubview(view)
|
||||
|
||||
@@ -17,13 +17,23 @@ struct MasterTableViewCellLayout {
|
||||
private static let unreadCountMarginLeft = CGFloat(integerLiteral: 8)
|
||||
private static let unreadCountMarginRight = CGFloat(integerLiteral: 8)
|
||||
|
||||
private static let chevronWidth = CGFloat(integerLiteral: 40)
|
||||
|
||||
let faviconRect: CGRect
|
||||
let titleRect: CGRect
|
||||
let unreadCountRect: CGRect
|
||||
|
||||
init(cellSize: CGSize, shouldShowImage: Bool, label: UILabel, unreadCountView: MasterUnreadCountView, showingEditingControl: Bool) {
|
||||
|
||||
let bounds = CGRect(x: 0.0, y: 0.0, width: floor(cellSize.width), height: floor(cellSize.height))
|
||||
let adjustedWidth: CGFloat = {
|
||||
if showingEditingControl {
|
||||
return floor(cellSize.width)
|
||||
} else {
|
||||
return floor(cellSize.width) - MasterTableViewCellLayout.chevronWidth
|
||||
}
|
||||
}()
|
||||
|
||||
let bounds = CGRect(x: 0.0, y: 0.0, width: adjustedWidth, height: floor(cellSize.height))
|
||||
|
||||
var rFavicon = CGRect.zero
|
||||
if shouldShowImage {
|
||||
|
||||
Reference in New Issue
Block a user