Questions tagged [uilongpressgesturerecogni]
147 questions
1
vote
1 answer
Trigger action when releasing LongPressGesture SwiftUI
I'm trying to trigger the message "pressed" when I release the LongPressGesture inside the minimumDistance but this code instead print out the message as soon as I long press on the Image. How can I solve this?
struct ContentView: View {
…

xmetal
- 681
- 6
- 16
1
vote
1 answer
SwiftUI - Make LongPressGesture remain when finger moves a bit?
I have a long-press gesture set up somewhat like this:
Text("Gesture text")
.onLongPressGesture(minimumDuration: 5, pressing: {
(isPressing){
self.doingStuff()
}
}
and it works fine, but the issue is that if a…

Evan
- 1,892
- 2
- 19
- 40
1
vote
0 answers
how to add pan gesture on long pressing a button
i have a button when i click button a view appear and i am performing some action to that specific view according to finger movement(pan gesture).
if i add view on just click the button it works fine. if i add the view on long press. then then pan…

Goal Tech
- 167
- 9
1
vote
1 answer
How can i resolve this Error :unrecognised selector sent to instance (LongPress onUIImageView)
reason: '-[HMIS_ios.ImageViewerVController longPressed:]: unrecognized selector sent to instance 0x7fe865576d70'
class ImageViewerVController: UIViewController {
@IBOutlet weak var ImageViewer: UIImageView!
var pass = ""
override func viewDidLoad()…

Jr Dev
- 33
- 8
1
vote
0 answers
How to detect long press within a view and its subviews swift
I have a view (I'll call it parentView) that has about 20-30 subviews. I have added a long press gesture recognizer to the parentView. The gesture recognizer only seems to fire when I press on the parentView, it does not fire when I press and hold…

coder
- 381
- 2
- 22
1
vote
0 answers
Adding long-press to a button while maintaining normal highlight behavior?
I have a button with a long-press gesture recognizer assigned to it.
I would like the button to remain highlighted (just as it would during a normal click) for the duration of a long press, AND for the single click NOT to be triggered after the long…

Nerdy Bunz
- 6,040
- 10
- 41
- 100
1
vote
1 answer
swift: long press gesture reconizer doesn work
I have a UITableView and I want to add UILongPressGestureRecognizer for each row.
I tried dragging the recognizer on the table cell and referencing an action for it, but that was never called.
I also tried
func tableView(_ tableView: UITableView,…

Ginso
- 459
- 17
- 33
1
vote
1 answer
UILongPressGestureRecognizer does not really work with numberOfTapsRequired and minimumPressDuration property
Here is my code first:
@IBAction func SOSLongPressed(_ sender: UILongPressGestureRecognizer) {
//sender.numberOfTapsRequired = 2
sender.minimumPressDuration = 3
if sender.state == .began {
print("long pressed")
…

D.D
- 11
- 2
1
vote
1 answer
UILongPressGestureRecognizer not calling its target method
This worked with devices on iOS 11, but with my device updated to iOS 12 it no longer works:
//the viewcontroller is initiated with UIGestureRecognizerDelegate
let longPressGesture = UILongPressGestureRecognizer(target: self, action:…

RanLearns
- 4,086
- 5
- 44
- 81
1
vote
1 answer
Detect long press on tableview
I know how to simply detect a long press, but it detect after release. How can I detect the long press without releasing the finger?
This is the code I am using for long press now:
override func viewDidLoad() {
super.viewDidLoad()
…

Camile
- 155
- 3
- 10
1
vote
0 answers
UILongPressGestureRecognizer Not Running Action or Is Not Recognized Despite Being Added to Views GestureRecognizers and Being Configured
I am using swift for an ios app, and it (of course) uses various gesture recognizers. I have not had too many problems with them up until now: I am using a UILongPressGestureRecognizer, and I think it is configured correctly (I just looked in the…

Liam Keeley
- 187
- 1
- 10
1
vote
1 answer
Why is this code to add a subview executing in this sequence?
I am making a small view show up after a long press (iconsContainerView) and am not understanding why the code in handleLongPress(gesture:) is executing in the manner that it is. It's my understanding that it should go top to bottom and each line…

Drew
- 674
- 5
- 14
1
vote
1 answer
UILongPressGestureRecognizer in Spritekit and Swift 4
I am a complete newbie to programming and I am trying to learn how to make a simple iOS game using Spritekit and Swift 4.
So far, I have achieved some mild success, but I would like to add some further details to the game to make it a little more…

FrankVIII
- 118
- 8
1
vote
2 answers
Why my code selects the next cell? - UILongPressGestureRecognizer
I'm trying to create a way to select a cell so that I can edit it. With the current code, the cell that is going up is always the next cell. And my last cell in my tableView can not be selected.
@objc func handleLongPress(_…

François
- 33
- 5
1
vote
1 answer
UIPanGestureRecognizer for programmatically added UIView
I want to create circle after long pressure gesture and make it move with pan gesture while still pressing finger on screen. When finger is moved from screen, circle should be removed from it.
Circle creation with long tap gesture works fine, just…

Rolandas
- 47
- 6