我是IOS的新手,我试图在UIView的双击上显示按钮列表。我有以下代码来捕捉双击手势:
Private Sub okButton_Click()
Dim i As Double, dt1 As String, dtt1 As String
Dim dt2 As String, dtt2 As String
dt1 = ComboBox1.Value
dtt1 = CDate(dt1)
dt2 = ComboBox2.Value
dtt2 = CDate(dt2)
Debug.Print dtt2
For i = 2 To 6724
If Range("A" & i).Value >= dtt1 And Range("A", i).Value <= dtt2 Then
Rows(i).Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
End If
Next
End Sub
我需要设计一个面板来显示按钮列表,例如开始,停止和暂停。有人可以指导我如何在敲击位置设计面板吗?
答案 0 :(得分:2)
您需要使用UITapGestureRecognizer
而不是UILongPressGestureRecognizer
。将UITapGestureRecognizer
设为numberOfTapsRequired
至2
。
let menuTap = UITapGestureRecognizer(target: self, action: #selector(showMenuPanel(_:)))
menuTap.numberOfTapsRequired = 2
//No need to set isUserInteractionEnabled to true because by default it is true for `UIView`
//self.view.isUserInteractionEnabled = true
self.view!.addGestureRecognizer(menuTap)
像这样添加tapGesture的动作方法。
func showMenuPanel(_ recognizer: UITapGestureRecognizer) {
print("TESTPANEL")
let point = recognizer.location(in: self.view)
//Get your view from nib
let view = CustomView()
//set its origin to this point
view.frame.origin = point
//add your view in self.view
self.view.addSubview(view)
}