I'm trying to trigger context menu with double tap but it is not working. I created double tap gesture for the add interaction to cell but there is no result with this usage.
I used contextMenuConfigurationForItemAt function for the Collection View context menu but it is trigger with long press on cell. I also want to add double tap feature for the present context menu.
Related
I have a collection view cell and a button as its subview. If you click the cell it goes to the detail page. And if you click the button it adds the item to the basket. I need to block the button from clicking more than 1. So I am disabling the button for a few seconds. But this time if I click the button before the delay ends, it goes to the detail page from the button too. Is there a way to solve this without disabling the cell itself?
Use custom delegate as call back in cell that will let the ViewController know that button is disable when user will tap on button. Store that disable state in some store property of ViewController.
let say flag = false
After that when user will tap cell didSelect delegate will get trigger. Then add there a check if flag == false do nothing and vice versa.
After few seconds change the stat of flag i.e. flag = true.
In this way you will not need to disable the cell and you can perform other events there.
Just giving you an idea as I cannot see you code I hope this will help.
I am adding annotations to a pdf document and this works as expected. Now I also want to delete them and here I am facing some issues.
As I see, it should work out of the box, but when I long click on an annotation mostly of the time the text around of it is being selected but not the annotation itself.
This is one example where I created a big annotation so that I am sure that my finger is not touching any text around of it. When I long click on it this is what I get most of the time (this is not always, sometimes the menu also appears over the annotation and I am able to delete it via the delete action):
I also tried to add a long-press/tap gesture on the PDFKit and in these situations when I long click on the annotation and the text is being selected, my long press gesture is not being fired. I assume that the view hierarchy inside PDFKit is causing this issue.
With the tap gesture I am able to detect the annotation when it's being tapped, but in this case the controller?? that is displaying the annotation text is not being shown (I guess because I intercept the tap gesture). Is there a way to still trigger the annotation display and modify the controller (add additional navigation button since now there is just a "Done" button)? This is the particular controller when I tap the orange note icon:
Adding hightlight annotations to text and removing them works as expected (because there is no problem with selecting text)
Is there a way to somehow force the PDFKit to mark the annotation as selected when I long click on it? Modifying the controller that is being displayed when an annotation is being tapped would also help.
In case somebody else is struggling with this.
I chose to display the annotation inside a custom controller.
First I implemented a TapGestureRecognizer on the pdfview, from there got the annotation and then displayed the annotation inside the custom controller.
Guys, I have table view which displays images so for any image tap opens the image in
didselectrowatIndexpath
So I wanted to add a long press gesture so I added
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressed(_:)))
cell.baseview.addGestureRecognizer(longPressGesture)
But each time I press and hold image it is going to didselectrowat method and opening the image instead of going to method longpressed.
Is there something I should change for long press gesture action ?
Here is an answer to your question by Apple.
Managing Selections (Responding to Selections)
If the touch occurred in a control embedded in the row, it could
respond to the action message sent by the control.
Understanding Responders and the Responder Chain
UIKit directs most events to the most appropriate responder object in your app. If that object does not handle the event, UIKit forwards it to the next responder in the active responder chain, which is a dynamic configuration of your app’s responder objects.
Solution:
You have an issue with user interaction of image. Enable user interaction on image view.
cell.baseview.isUserInteractionEnabled = true
I am thinking of developing a custom keyboard where each key has three distinct button actions:
Single tap
Double tap
Long press
1 and 2 are for directly inputting common characters while 3 will be for a pop menu to select input for less common characters.
I've used UIButton touchUpInside event for single tap and UITapGestureRecognizer for double tap. I can somewhat make it work as separate events on a single button in the Main Storyboard, but it was kind of wonky on the Keyboard Storyboard for the Keyboard View Controller. Double tap on the button doesn't do anything.
Any advice appreciated.
I want to do a draggable UITableView (this part is working), but when I long press on one row I want to show boxes to change cell's content.
The problem is that long press in editing mode is fired when I am pressing drag or delete button, causing drag event to be stopped. I can't use [[self tableView] isDragging] to ignore long press when I am dragging because it only returns true when I have already dragged far enough.
To summarise I need:
Drag event not to be stopped when long press is fired.
Ignore long press inside drag or delete buttons.
Any ideas?