label showing top of screen instead of being on the inputAccessoryView(标签显示屏幕顶部而不是在 inputAccessoryView)
问题描述
这是我的代码:
我正在尝试将 inputAccessoryView 添加到我的 TextView 的键盘.我的 inputAccessoryView 必须有一个标签说你有 100 个字符的限制"...
I'm trying to add an inputAccessoryView to my TextView's keyboard. My inputAccessoryView must have a label saying "You have a 100 character limit"...
但我目前的结果是:
蓝色的文本...正是我想要在 inputAccessoryView 中出现的标签,但它在我的屏幕顶部...
The text in the blue...is exactly the label I want to be in the inputAccessoryView, but it's on the top of my screen...
推荐答案
需要将标签上的translatesAutoresizingMaskIntoConstraints
设置为false
和isActive
到 true
上的约束.基本上你的约束代码应该是这样的:
You need to set translatesAutoresizingMaskIntoConstraints
on the label to false
and isActive
to true
on the constraints. Basically your constrains code should look like this:
这篇关于标签显示屏幕顶部而不是在 inputAccessoryView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!