Closed BhaktiKarva closed 7 years ago
I figured that the popover is not going because if self.superview != nil
always returns nil and so it does not dismiss the popover. How to solve this?
I made a few changes and instead of the collection view, I am adding a UIView with some buttons. The problem is it still does not dismiss the popover. I am getting really confused here. Please help.
Here is my code
//create view
let aview = UIView(frame: CGRect(x: 0, y: 0, width: (self.view.frame.width/4), height: button.frame.height))
let width = (self.view.frame.width/4)/(CGFloat(extras.count))
//adding buttons
for i in 0...(extras.count-1) {
let butt = UIButton(frame: CGRect(x: (CGFloat(i)*width), y: 0, width: width, height: (aview.frame.height)))
butt.setTitle(extras[i], for: .normal)
butt.setTitleColor(UIColor.black, for: .normal)
butt.addTarget(self, action: #selector(keyPressedletter(_:)), for: .touchUpInside)
aview.addSubview(butt)
}
//show pop-up
self.popover1.show(aview, fromView: button, inView: self.view)
Can you please help me with issue. I really need it to work. :(
I think it can be solved if there is your demo project.
The project is too big to understand the location of the problem. Is it okay for me to just demo the problem?
ok. how do you wanna connect? Teamviewer? Skype?
That's a bit difficult. (I am not good at English) So can I have a small sample project with only the problem part?
in the main project - > Ghanakey-keyboard extension. In that go to the KeyboardViewController. Go the mark //gestures. In that there is a ShowPop method. Everything works fine. But when I try to dismiss the popup, it remains there only. I figured out that it does not dismiss because in the Popover.swift file, in the dismiss() mehtod if self.superview != nil
always returns nil and it does not dismiss.
https://github.com/corin8823/Popover/commit/c9c08eb436769c381a4eae6d3a8010f25d86e8fb I fixed it with this commit. I could dismiss if it was a current master popover.
But I do not dismiss when it is keyPressedletter
I tried with your new commit, but it is still not dismissing the popover.
If I click anywhere else, it dismiss the popover. But on calling popover.dismiss() is not dismissing the popover. Can you please help me in this?
Umm
It works with this example
fileprivate var popoverOptions: [PopoverOption] = [
.type(.up),
- .blackOverlayColor(UIColor(white: 0.0, alpha: 0.6))
+ .showBlackOverlay(false)
I tried, but still not working. When I click anywhere other than the popover, it dismisses the popover. Bu on clicking any any button, it does not dismiss.
I finally got it working. The problem was I was initialising the popover in the @IBAction method. I shifted that to the viewDidLoad method and now it is working fine. Thank you for all the help :)
Hello, I am displaying a popover on a gesture recogniser. The popover shows a custom collectionview. But i am not able to dismiss the popover by using
popover.dismiss
.Here is my code:
` class KeyboardViewController: UIInputViewController , ISEmojiViewDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
`
but whenever I select something from the popover, it does not dismiss.