ios - 按钮点击事件不触发

标签 ios swift uibutton

目前,我正在使用一个 UI,需要单击按钮,当按钮 alpha 为 1 时,当我将其更改为 0 时,它可以正常工作,但我无法获取按钮触摸事件? 有什么理由吗?

最佳答案

来自apple documentation :

To hide a view visually, you can either set its hidden property to YES or change its alpha property to 0.0. A hidden view does not receive touch events from the system. However, hidden views do participate in autoresizing and other layout operations associated with the view hierarchy. Thus, hiding a view is often a convenient alternative to removing views from your view hierarchy, especially if you plan to show the views again at some point soon.

关于ios - 按钮点击事件不触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43980844/

相关文章:

ios - 抓取从 UIImagePickerController 保存的图像?

ios - 查找从哪个地区的应用商店下载 iOS 应用

swift - Alamofire,使用未声明的类型

ios - 如何从弹出 View Controller 获取数据到自定义表格 View 单元格?

ios - 当我尝试在 JSONWebToken 的框架上解码我的 token 时出现错误 "Failed to decode JWT: Unsupported algorithm or incorrect key"

ios - 使用 IOS9 时,无法在 UITable 节标题上的 UIButtons 上触发触摸事件(IOS10 没问题)

android - 从 Android 和 iOS 中的相同代码库开发多个应用程序

ios - 当 searchBar 在部分标题中时,UICollectionView reloadData 退出第一响应者/关闭键盘

ios - 使用我的 ios 应用程序 iOS 9 Swift 2.2 中的指示打开 Apple map 应用程序

ios - 以编程方式设置 UIButton 文本颜色