fixed toolbar edit button in packdetailview

This commit is contained in:
Nihaal Sharma committed 2026-07-03 22:21:31 +01:00
1 parent 698c711ab7
commit b939071674
1 file changed
+8 -9
@@ -25,8 +25,8 @@ class EmojiPackDetailViewController: UINavigationController {
)
super.init(rootViewController: collectionView)
let editButton = UIBarButtonItem(systemItem: .edit)
editButton.target = self
let editButton = collectionView.editButtonItem
editButton.target = collectionView
let downloadButton = UIBarButtonItem(
image: UIImage(systemName: "arrow.down"),
style: .plain,
@@ -39,8 +39,10 @@ class EmojiPackDetailViewController: UINavigationController {
target: nil,
action: nil
)
collectionView.navigationItem.title = "HI"
collectionView.toolbarItems = [editButton, downloadButton, shareButton]
collectionView.navigationItem.title = pack.name
// collectionView.toolbarItems = [editButton, downloadButton, shareButton]
collectionView.navigationItem.leftBarButtonItem = editButton
collectionView.navigationItem.rightBarButtonItems = [shareButton, downloadButton]
NotificationCenter.default.addObserver(
self,
@@ -55,14 +57,11 @@ class EmojiPackDetailViewController: UINavigationController {
}
@objc func packChanged(_ notification: Notification) {
if notification.name == EmojiHoarder.NotifCategory.emojiPack(pack.id).name {
print("ooh its this pack")
guard notification.name == EmojiHoarder.NotifCategory.emojiPack(pack.id).name else { return }
guard let updatedPack = hoarder.emojiPacks.first(where: { $0.id == pack.id }) else { return }
self.pack = updatedPack
collectionView.navigationItem.title = pack.name
collectionView.refreshUI(with: pack.items)
} else {
print("diff one")
}
}
override func setEditing(_ editing: Bool, animated: Bool) {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.