简体   繁体   English

使用点击手势识别器禁用提示视图

[英]Using tap gesture recognizer to disable a tip view

Currently, I have question buttons bring up a tip view when pressed. 目前,我有问题按钮在按下时会弹出提示视图。 Now what I want to do is lock the button after it's been pressed, but after you press the screen once the tip view goes away and the button gets re-enabled. 现在,我要做的是在按下按钮后将其锁定,但是在按下屏幕后,一旦笔尖视图消失并且按钮被重新启用。 I've figured out to use a tap gesture recognizer, but I don't know where exactly to connect it. 我已经确定要使用点击手势识别器,但是我不知道该在哪里正确连接它。 I also don't know how to include the button or tip view in the function. 我也不知道如何在功能中包含按钮或提示视图。 I'm fairly new to swift, so I apologize if this is common knowledge that I should know. 我是新手,因此如果我是我应该知道的常识,我深表歉意。

I'm giving you tips: 我给你提示:

  • Add button and your tipView on your main view. 在主视图上添加按钮和tipView。

  • set hidden=true for tipView. 为tipView设置hidden=true

  • Add tap gesture and it's method on main view. 在主视图上添加点击手势及其方法。

  • in Button's action method write code for unhide tipView means here you should write hidden=false for tipView 在Button的操作方法中,为未隐藏的tipView编写代码意味着在这里,您应该为tipView写hidden=false

  • Now again write hidden=true in tap gesture's method that you added in your code. 现在,再次使用您在代码中添加的轻击手势方法编写hidden=true

This is simple tips that might be helpful for you, here you can add animation for hide/show tipView. 这些简单的提示可能对您有所帮助,您可以在此处为隐藏/显示 tipView 添加动画

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM