ios - 如何在 Swift 的 UIButton 扩展中使用 UIButton 实例作为参数创建函数?
问题描述
我有一些 UIButton 实例(按钮),并且还想为每个实例添加一个披露指示器。因此,我想创建一个辅助函数。但是,我不知道如何使用 UIButton 实例作为 UIButton 扩展中的参数来做到这一点。以下是我目前拥有的代码。
@IBOutlet weak var checkByDepartment: DesignableButton!
let disclosure = UITableViewCell()
disclosure.frame = checkByDepartment.bounds
disclosure.accessoryType = .disclosureIndicator
disclosure.isUserInteractionEnabled = false
checkByDepartment.addSubview(disclosure)
任何帮助,将不胜感激!
解决方案
推荐阅读
- bash - 为 scp -i 使用变量不起作用,但传递文件名有效
- c# - ItemsControl 中的页面绑定
- sql - 如何将 PSQL 表增加一年
- firebase - 如何对托管在 Firebase 中的静态站点进行 IP 白名单?/ Firebase 托管是否有 WAF?
- unity3d - 检测到遗留物质材料(使用新版本的 Unity 时)
- node.js - NodeJS 存储基于文件的 JSON 数据库的最佳方式?
- c# - 向 CefSharp v51 添加控件(如 URL 栏、返回、刷新)
- bash - 如何将 shell 完成推迟到 bash 和 zsh 中的另一个命令?
- python - 如何导入依赖 psycopg2 游标对象的辅助函数?
- sql - 如何编写 case 语句以返回重复记录?