Comments (9)
Quote from LouK in Slack discussion:
it seems that the selected state of an item persists across multiple presentations of a menu... is there a way to deselect a selected item, or to not have the selection latched when the menu is dismissed? Looked at the source but I don't see where the selection is maintained...it almost looks like the completion closure in actionSelected's UIView.animate is not executing.
using the manager... looks like this when presenting the menu after previously selecting the middle item:
from popmenu.
I'm seeing this issue and I thought it was an issue with how I programmed. But after reviewing the documentation countless times and viewing your examples, this bug is getting pretty annoying. Any updates?
from popmenu.
@HackShitUp sorry for the inconvenience it had caused you, yeah I am aware of this bug and there will be a patch for all of the issues by the end of month December, thank you for the support!
from popmenu.
@HackShitUp for now the easiest way as a workaround would be using the PopMenuViewController
instance
from popmenu.
@CaliCastle Happy New Year (if you'are around the U.S. haha)! So I do use that in our application, but the issue still persists. Do you know why the carryovers occur? I can try and fix it myself if I can understand the problem
from popmenu.
@HackShitUp hi, happy New Years to you too!! Actually this fix is already completed in my local environment I just need to make some adjustments before releasing an update, it'll be sometime later this week, thanks for the support and using PopMenu, I appreciate it!
from popmenu.
from popmenu.
@HackShitUp fixed in v2.1.2
from popmenu.
@CaliCastle I still get this issue whenever I'm presenting it from a UICollectionViewCell.
// Unwrap the 'Capsule' PFObject
guard capsule != nil else { return }
// MARK: - UINotificationFeedbackGenerator
let feedbackGenerator = UINotificationFeedbackGenerator()
feedbackGenerator.notificationOccurred(.success)
// MARK: - PopMenu
let manager = PopMenuManager.default
manager.popMenuAppearance.popMenuColor.backgroundColor = .solid(fill: .white)
manager.popMenuAppearance.popMenuFont = UIFont.demibold(size: 14)
manager.popMenuAppearance.popMenuCornerRadius = 16
manager.popMenuAppearance.popMenuItemSeparator = .fill(.groupTableViewBackground, height: 1)
manager.popMenuShouldDismissOnSelection = true
// Unlock Capsule
let unlockAction = PopMenuDefaultAction(title: "Unlock", image: UIImage(named: "Unlocked")!, color: UIColor.black) {
(action: PopMenuAction) in
// MARK: - PFObject(className: "Capsule")
self.capsule["isPrivate"] = false
self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
if success {
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "✅ Unlocked Album", color: UIColor.black.withAlphaComponent(0.80))
DispatchQueue.main.async {
// Reset the lockButton
self.lockButton.setImage(nil, for: .normal)
}
// MARK: - NotificationCenter
NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
} else {
print(error?.localizedDescription as Any)
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Unlock Album", color: UIColor.black.withAlphaComponent(0.80))
}
})
}
// Lock Capsule
let lockAction = PopMenuDefaultAction(title: "Lock", image: UIImage(named: "Locked")!, color: UIColor.black) {
(action: PopMenuAction) in
// MARK: - PFObject(className: "Capsule")
self.capsule["isPrivate"] = true
self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
if success {
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "✅ Locked Album", color: UIColor.black.withAlphaComponent(0.80))
DispatchQueue.main.async {
// Reset the lockButton
self.lockButton.setImage(UIImage(named: "Locked"), for: .normal)
self.lockButton.addTarget(self, action: #selector(self.unlockCapsule(_:)), for: .touchUpInside)
}
// MARK: - NotificationCenter
NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
} else {
print(error?.localizedDescription as Any)
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Lock Album", color: UIColor.black.withAlphaComponent(0.80))
}
})
}
// Edit Capsule
let editAction = PopMenuDefaultAction(title: "Edit Name", image: UIImage(named: "Pen")!, color: UIColor.black) {
(action: PopMenuAction) in
manager.popMenuDidDismiss = { didSelect in
// MARK: - CSAlertManager
CSAlertManager.shared.renameCapsule(self.capsule, completionHandler: { (object: PFObject, success: Bool) in
if success {
// MARK: - NotificationCenter
NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
}
})
}
}
// Send Capsule
let sendAction = PopMenuDefaultAction(title: "Send", image: UIImage(named: "TabChat")!, color: UIColor.black) {
(action: PopMenuAction) in
manager.popMenuDidDismiss = { didSelect in
if didSelect == true {
// MARK: - TagUsersViewController
let tagUsersVC = TagUsersViewController.init(delegate: self, type: .send, existingUsers: nil, object: self.capsule)
// MARK: - CSNavigationController
let csNavigationController = CSNavigationController.init(rootViewController: tagUsersVC, type: .pushPop)
csNavigationController.presentNavigationFrom(viewController: self.parentViewController!)
}
}
}
// Delete Capsule
let leaveAction = PopMenuDefaultAction(title: "Leave Album", image: UIImage(named: "LeaveButton")!, color: UIColor.black) {
(action: PopMenuAction) in
manager.popMenuDidDismiss = { didSelect in
if didSelect == true {
// MARK: - UIAlertController
let alertController = UIAlertController.init(title: "Leave Album?", message: "Are you sure you would like to leave this album? Your friends would have to add you again to add moments to them.", preferredStyle: .actionSheet)
// Leave Action
let leaveAction = UIAlertAction.init(title: "Leave Album", style: .destructive, handler: { (action: UIAlertAction) in
self.capsule.remove(PFUser.current()!.objectId!, forKey: "collaborators")
self.capsule.saveInBackground(block: { (success: Bool, error: Error?) in
if success {
// Remove the 'Capsule' object id
PFUser.current()!.remove(self.capsule.objectId!, forKey: "autoSaveKeys")
PFUser.current()!.saveInBackground()
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "😢 Sad to see you go...", color: UIColor.black.withAlphaComponent(0.80))
// MARK: - NotificationCenter
NotificationCenter.default.post(name: GalleryViewController.reloadCapsules, object: nil)
} else {
print(error?.localizedDescription as Any)
// MARK: - CSAlertManager
CSAlertManager.shared.showAlertBanner(title: "💩 Couldn't Unlock Album", color: UIColor.black.withAlphaComponent(0.80))
}
})
})
// Cancel Action
let cancelAction = UIAlertAction.init(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction) in
alertController.dismiss(animated: true, completion: nil)
})
alertController.addAction(leaveAction)
alertController.addAction(cancelAction)
self.parentViewController?.present(alertController, animated: true, completion: nil)
}
}
}
if capsule!.value(forKey: "isPrivate") as! Bool == false {
//
// Lock
//
manager.addAction(lockAction)
} else {
//
// Unlock
//
manager.addAction(unlockAction)
}
manager.addAction(editAction)
manager.addAction(sendAction)
manager.addAction(leaveAction)
manager.present(sourceView: self)
from popmenu.
Related Issues (20)
- How can i hide status bar ?
- Can I reposition PopMenu out of center (e.g. next to tapped button)?
- Need support for Attributed string
- 两个问题
- Need a option to disable a user interaction for a PopMenuDefaultAction
- Dismiss PopMenu Programmatically HOT 2
- PopMenuPresentationStyle Doesn't Do Anything
- need to add text alignment "left","center","right"
- 样式设置失效及坐标微调问题
- cornerRadius of PopMenuDefaultAction doesnt do anything
- No light/dark mode Support HOT 1
- Solid Background Colors Have Alpha Value of 0.9
- 锚定一个视图后设备旋转后需要跟随
- 可以修改背景阴影吗?菜单项颜色怎么不是我设置的颜色?
- 可以支持icon 放右边吗
- Xcode 13 compatibility issue - Haptics.swift HOT 1
- Xcode 13.0 Enum cases with associated values cannot be marked potentially unavailable with '@available' HOT 6
- Add Feature For Border Color
- Why isn't the background pure white? pure white like android? HOT 2
- How to Offset Bottom Left? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from popmenu.