在UILongPressGestureRecognizer中按下时间

时间:2018-06-18 22:46:06

标签: ios swift uilongpressgesturerecogni

我试图通过ViewController

来获得按下UIView的时间

但是,UILongPressGestureRecognizer的状态为press:UILongPressGestureRecognizer.began.end.cancelled

但是,我试图知道是否按.changed秒来改变对x的控制。

我目前的代码是:

UIView

但是,我找不到知道按下时间的方法。 有办法吗?

1 个答案:

答案 0 :(得分:0)

长按开始时,请记下时间(开始)。取消,结束或失败时;可选择计算从开始的秒数。如果印刷机持续时间超过5秒,则myView为红色。

1. Modify two configure files
# vi /var/lib/pgsql/data/postgresql.conf
 Replace the line:
listen_addresses = 'localhost'  -> listen_addresses = '*'
# vi /var/lib/pgsql/data/pg_hba.conf
 Add the line at the very end:
host all all 0.0.0.0/0 trust
(If IPv6:
host all all ::/0 trust) 
2. Restart the database service
# service postgresql restart
3. Disable the firewall
# rcSuSEfirewall2 stop
# chkconfig SuSEfirewall2 off
# chkconfig SuSEfirewall2_init off