mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
fix edit button and cleanup
This commit is contained in:
2 files changed
+11
-34
No files matched your search
@@ -50,19 +50,6 @@ class EmojiPackDetailViewController: UIViewController {
|
|||||||
target: nil,
|
target: nil,
|
||||||
action: #selector(share)
|
action: #selector(share)
|
||||||
)
|
)
|
||||||
// super.init(nibName: nil, bundle: nil)
|
|
||||||
// self.setviewcontrollers
|
|
||||||
// self.addChild(collectionView)
|
|
||||||
// self.view.addSubview(collectionView.view)
|
|
||||||
// collectionView.view.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
// NSLayoutConstraint.activate([
|
|
||||||
// collectionView.view.topAnchor.constraint(equalTo: self.view.topAnchor),
|
|
||||||
// collectionView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
||||||
// collectionView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
|
|
||||||
// collectionView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
|
|
||||||
// ])
|
|
||||||
|
|
||||||
// super.init(rootViewController: collectionView)
|
|
||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
collectionView.navigationItem.title = pack.name
|
collectionView.navigationItem.title = pack.name
|
||||||
|
|
||||||
@@ -74,7 +61,7 @@ class EmojiPackDetailViewController: UIViewController {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
self.collectionView.navigationItem.setRightBarButtonItems(
|
self.collectionView.navigationItem.setRightBarButtonItems(
|
||||||
[self.editButtonItem],
|
[self.collectionView.editButtonItem],
|
||||||
animated: true
|
animated: true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -147,23 +134,18 @@ class EmojiPackDetailViewController: UIViewController {
|
|||||||
present(shareSheet, animated: true)
|
present(shareSheet, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func setEdit() {
|
|
||||||
collectionView.setEditing(!collectionView.isEditing, animated: true)
|
|
||||||
if collectionView.isEditing {
|
|
||||||
collectionView.navigationItem.setRightBarButtonItems(
|
|
||||||
[self.editButtonItem, adderSheetButton],
|
|
||||||
animated: true
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
collectionView.navigationItem.setRightBarButtonItems(
|
|
||||||
[self.editButtonItem],
|
|
||||||
animated: true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
NotificationCenter.default.post(name: EmojiHoarder.NotifCategory.emojiPack(pack.id).name, object: nil)
|
NotificationCenter.default.post(name: EmojiHoarder.NotifCategory.emojiPack(pack.id).name, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewWillDisappear(_ animated: Bool) {
|
||||||
|
super.viewWillDisappear(animated)
|
||||||
|
guard hoarder.emojiPacks.contains(pack) else { return }
|
||||||
|
guard let index = hoarder.emojiPacks.firstIndex(of: pack) else { return }
|
||||||
|
if hoarder.emojiPacks[index] != pack {
|
||||||
|
hoarder.emojiPacks[index] = pack
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -50,11 +50,6 @@ final class TabbedContentView: UITabBarController, UITabBarControllerDelegate {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func tabBarController(_ tabBarController: UITabBarController, willSelect viewController: UIViewController) {
|
|
||||||
guard let navController = viewController as? UINavigationController else { return }
|
|
||||||
navController.popToRootViewController(animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
|
// override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
|
||||||
// item
|
// item
|
||||||
// }/
|
// }/
|
||||||
|
|||||||