![](/img/trans.png)
[英]How to detect long press on a UICollectionViewCell and and perform an action a the cell
我有一個顯示在 UICollectionViewCell 中的圖像列表。 現在我想要一種在用戶長按單元格時在圖像上顯示疊加層的方法。 我已經能夠在單元格上放置一個長按手勢,但不幸的是如何在單元格上執行覆蓋是我努力實現的地方。 在我的 cellForItemAt 我有這個 我有這個 function ...
[英]How to detect long press on a UICollectionViewCell and and perform an action a the cell
我有一個顯示在 UICollectionViewCell 中的圖像列表。 現在我想要一種在用戶長按單元格時在圖像上顯示疊加層的方法。 我已經能夠在單元格上放置一個長按手勢,但不幸的是如何在單元格上執行覆蓋是我努力實現的地方。 在我的 cellForItemAt 我有這個 我有這個 function ...
[英]Adding UILongPressGesture to Cell not CollectionView
我正在嘗試將UILongGestureRecognizer添加到我的自定義 CollectionView 單元中,但處理程序 function從未調用過。 這是來自自定義單元格的gesture和handlerFunc : 另外,這是我的cell configure function: } ge ...
[英]How to limit a process between LongPressGesture-began and LongPressGesture-ended
要求很簡單:當用戶觸摸屏幕並按住手指時,我想啟動一個活動(例如在屏幕上繪制圓圈)。 當手指再次抬起時,該活動將立即停止。 所以我使用了UILongPressGestureRecognizer 。 這會產生一個.began 和.ended 事件。 但是問題是當一個activity基於the.began ...
[英]On long press, how do you call an ImagePreviewController: UIViewController from an objective c function instead of a contextMenuInteraction function?
下面這個 function 需要將 go 改為 ObjC function 現在對象 C function ObjC 在覆蓋 function 中獲取句柄 我目前遇到什么錯誤: 非空中空 function。 也就是說,如果我將代碼的 ringy/image3 和 green/image3 部分放 ...
[英]UILongPressGestureRecognizer to accept a flexible amount of touches
我有一個 UILongPressGestureRecognizer ,當屏幕上有 1 根手指時會觸發它。 但是,只要我放 2 根手指,function 就不再觸發,我需要為 2 根手指創建一個新手勢。 如何讓 UILongPressGestureRecognizer 接受靈活的觸摸量? ...
[英]How to detect "long tap"
我有一個UIView視圖,我想在用戶按下然后釋放時執行一些操作。 我在視圖中添加了一個UITapGestureRecognizer ,它僅在點擊持續時間很短時觸發。 如果用戶觸摸視圖,等待幾秒鍾然后抬起手指,則什么也不會發生。 如何檢測“長按”事件? UILongPressGestureReco ...
[英]How to reset/restart NSTimer in tap LongPressGesture Objective-C
我在長按手勢中遇到 NSTimer 的小問題。 如何使任何新聞的計時器無效? 如果我長按了計時器,則從任何按下的單元格開始計時。 例如,我長按了 3 個單元格,定時器工作了 3 次。 我不知道。 下面是我的代碼,我在一段時間后嘗試給出一個條件,現在hideButtonTimer不算數。 我有 NS ...
[英]UILongPressGestureRecognizer location function issue in collectionView iOS 13.2
當拖動項目原始 position 時,我使用 UILongPressGestureRecognizer 位置(在:UIView?)方法進行了有線閃爍。 單元格時有不自然的輕彈。 在 iOS 12 中一切正常。 這是來自 SumeetMourya 的演示項目演示分支的鏈接 ...
[英]Trigger action when releasing LongPressGesture SwiftUI
當我在 minimumDistance 內釋放 LongPressGesture 時,我試圖觸發“按下”消息,但是當我長按圖像時,此代碼會立即打印出消息。 我該如何解決這個問題? ...
[英]How do you get the location of touches for a UILongPressGestureRecognizer when the number of required touches is more than one in swift?
我想從 UILongPressGuestureRecognizer 獲取多個多次觸摸的位置,其中所需的觸摸次數不止一個。 我知道當使用一根手指時我可以執行以下操作來獲取位置。 我也知道我可以在觸摸開始回調中迭代觸摸,但是我正在嘗試利用 UILongPressGestureRecognizer 中的 ...
[英]How to fail a LongPressGesture on SwiftUI
當我將手指從圖像上移開時,我試圖用 maximumDistance 使 LongPressGesture 失敗,但這不起作用,它會一直打印消息“Pressed” ...
[英]SwiftUI - Make LongPressGesture remain when finger moves a bit?
我有一個長按手勢,有點像這樣: 它工作正常,但問題是如果用戶按下它,按住它,然后稍微移動他們的手指,那么LongPressGesture 就會停止觸發。 我想以某種方式避免這種情況。 有沒有辦法做到這一點? 也許像增加 LongPressGesture 區域的半徑? 這對於手指較大的人尤其有用。 ...
[英]Swift - How to get the sender tag for an array of buttons using UILongPressGestureRecognizer?
我在 storyboard 中有一些按鈕,我將它們放入了參考插座集合中。 我對所有這些按鈕都使用了 UITapGestureRecognizer 和 UILongPressGestureRecognizer,但是我怎樣才能准確地打印出哪個按鈕被點擊了呢? 貝婁是我試過但沒有用的。 我收到一條錯誤消 ...
[英]Recognize both UILongPressGestureRecognizer and UIPanGestureRecognizer on same UIButton
我想制作一個UIButton ,當你長按它時,它會開始錄制視頻,如果你垂直向上平移手指(同時仍然長按),視頻會放大。 在我的按鈕上,我添加了一個UILongPressGestureRecognizer和一個UIPanGestureRecognizer來實現這一點。 單獨地,他們工作。 但是,它們不 ...
[英]Trying to call a long tap gesture and run a command but running into a SIGABRT error with the selector in the function. What isn't connected?
我的代碼: 然后我的函數在選擇器中被調用: 但是,當我運行它並嘗試長按按鈕時,我收到此錯誤: -[UILongPressGestureRecognizer 標簽]:無法識別的選擇器發送到實例 0x7fbc5ce00680 我不知道是因為我命名標簽錯誤還是因為我創建 LongPre ...
[英]Adding UILongPressGesture to UITableView in iOS13
我已經將UILongPressGesture與UITableView使用了一年多,但是我發現這在iOS13中不起作用。 在iOS13中,Apple將此手勢添加到了UIScrollView ,但我不確定將其替換為我自己的手勢是安全的。 有人知道這個問題嗎? 或知道_handleKn ...
[英]Resolve UITapGestureRecognizer and UILongPressGestureRecognizer simultaneously and fire UIGestureRecognizer.State.began on finger touch down
首先,所有已經回答的問題都對我沒有幫助 Swift:長按手勢識別器-檢測水龍頭和長按 在表格視圖中同時使用輕擊手勢和長按 長按手勢識別器僅在手指松開時觸發 等等 該代碼幾乎可以正常工作,只有一件事:長按手勢僅在我將手指從屏幕上抬起時調用。 但是我需要表 ...
[英]how show user selected cell of tableview on longpress
您好,我在UILongPressGesture中添加了UILongPressGesture ,並且添加成功,但問題是如何顯示選中的單元格,我的意思是我想更改所選單元格的顏色,當我再次對選定的單元格進行長按時,我想刪除的單元格 我試圖用代碼在我的表視圖中添加長按並在LongPress上分配代 ...
[英]How can i resolve this Error :unrecognised selector sent to instance (LongPress onUIImageView)
原因: '-[[HMIS_ios.ImageViewerVController longPressed:]:無法識別的選擇器發送到實例0x7fe865576d70' 我想使用UILongPressGestureRecognizer將圖片保存在圖庫中 ...
[英]Swift Programmatically Launch a UILongPressGesture
我想在用戶觸摸按鈕時以編程方式啟動UILongPressGesture 。 這是幾年前問的, 我如何以編程方式發送UILongPressGesture? 但我想知道是否有更清潔或更現代的解決方案。 我現有的UILongPressGestureRecognizer代碼(將實際用戶交互映射 ...