diff --git a/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist b/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist index 59a5781..9daf2f6 100644 --- a/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ Icro-Next.xcscheme_^#shared#^_ orderHint - 4 + 5 Icro-Share.xcscheme_^#shared#^_ diff --git a/IcroUIKit/View/ItemTableViewCell.swift b/IcroUIKit/View/ItemTableViewCell.swift index 3a8b50d..1049b35 100644 --- a/IcroUIKit/View/ItemTableViewCell.swift +++ b/IcroUIKit/View/ItemTableViewCell.swift @@ -11,6 +11,10 @@ import SnapKit import Settings public final class ItemTableViewCell: UITableViewCell { + enum Constants { + static let actionButtonWidth: CGFloat = 120.0 + } + var isFavorite: Bool = false @IBOutlet private weak var imageHeightConstraint: NSLayoutConstraint! @@ -67,7 +71,14 @@ public final class ItemTableViewCell: UITableViewCell { } } - @IBOutlet weak var actionButton: UIButton! + private let actionButton: UIButton = { + let button = UIButton(type: .custom) + button.setImage(UIImage(symbol: .ellipsis), for: .normal) + button.translatesAutoresizingMaskIntoConstraints = false + button.tintColor = Style.Color.separatorColor + + return button + }() @IBOutlet weak var imageCollectionView: UICollectionView! { didSet { @@ -94,12 +105,7 @@ public final class ItemTableViewCell: UITableViewCell { override public func awakeFromNib() { super.awakeFromNib() - actionButton.showsMenuAsPrimaryAction = true - actionButton.menu = UIMenu(options: .displayInline, children: [ - UIAction(title: "Test", handler: { _ in - print("test") - }) - ]) + setupActionButton() updateAppearance() let avatarGestureRecognizer = UITapGestureRecognizer(target: self, @@ -108,6 +114,15 @@ public final class ItemTableViewCell: UITableViewCell { backgroundColor = Color.backgroundColor } + private func setupActionButton() { + addSubview(actionButton) + NSLayoutConstraint.activate([ + actionButton.widthAnchor.constraint(equalToConstant: Constants.actionButtonWidth), + actionButton.bottomAnchor.constraint(equalTo: bottomAnchor), + actionButton.centerXAnchor.constraint(equalTo: centerXAnchor) + ]) + } + deinit { NotificationCenter.default.removeObserver(self) } diff --git a/IcroUIKit/View/ItemTableViewCell.xib b/IcroUIKit/View/ItemTableViewCell.xib index 0392d2c..c91337d 100644 --- a/IcroUIKit/View/ItemTableViewCell.xib +++ b/IcroUIKit/View/ItemTableViewCell.xib @@ -1,9 +1,8 @@ - + - @@ -76,20 +75,10 @@ - - @@ -97,7 +86,6 @@ - @@ -105,7 +93,6 @@ - @@ -118,10 +105,4 @@ - - - - - -