ios - 在 iPad 上的 inputAssistantItem 中为 UIBarButtonItems 着色
问题描述
我有几个UIBarButtonItems
习惯于将格式应用于UITextView
. 在 iPhone 上,这些按钮被添加到为 textviewUIToolbar
设置的。inputAcessoryView
在 iPad 上,按钮被添加到 textview 的inputAssistantItem
工具栏中。
通过更改 UIBarButtonItems 的 tintColor 来打开或关闭按钮的状态(即,当当前选择的 NSRange 应为粗体时,更改粗体按钮的 tintColor 以指示它处于活动状态)。
当将 UIBarButtonItems 添加到 iPhone 上的 UIToolbar 时,这非常有用,但我无法让它为 iPad 上的 inputAssistantItem 工作。当我更改按钮的 tintColor 时,没有任何变化。
解决方案
对于任何感兴趣的人,我设法通过向每个 UIBarButtonItem 添加一个 UIButton 然后更改按钮的 tintColor 而不是 UIBarButtonItem 来解决此问题。
推荐阅读
- c++ - 包装一个对象并假装它是一个 int
- swift5 - 一些标签和uitextfiled,并且在选择深色dode时会自动变为黑色
- azure - 从本地网络解析 Azure VM 的 DNS
- sql - 不能使用 LOOP PostgreSQL
- terraform - Github Actions 和 git clone 问题
- java - 如何连接两个webelement,对其进行迭代并从连接的Xpath中获取文本
- python - 如何使用 python 对我的文件(高分)进行排序?
- python - 有没有办法在 Django 的 settings.py 中创建第二个 LOGIN_REDIRECT_URL?
- java - 软键盘不出现
- python - Pandas lambda 函数无法识别 NaN