在切换安全文本条目时,为什么UITEXTFIELD框架会更改?
我有一个uitextfield
,其中包含一个尾随的按钮,可以切换文本字段的issecureentry
值。切换issecureentry
的逻辑按预期工作,但是当切换issecureentry
时,文本字段的框架高度扩展或高度约为2.5点。
用于按钮测量的两个图像资产72x72点,因此我认为更改不是更改按钮的图像的结果。
我们正在使用自定义字体,因此我认为在iSseCureentry
的每个切换之后,我可能需要重置字体(文本字段的插入高度也受到影响)。我采取的步骤如下:
我已订阅
uitextfield.textdidchangenotification
s,以便在issecureentry
之后设置字体,假设字符的更改将变更导致通知发布,但这似乎没有发生,因为未触发选择器上的断点。我使用相同的逻辑为
touchupinside
事件的按钮选择器中的文本字段设置,但这也不能解决帧更改。
当issecureentry
切换时,可能导致文本字段的帧更改是什么?
I have a UITextField
that contains a trailing-edge button to toggle the text field's isSecureEntry
value. The logic for toggling isSecureEntry
works as expected, but the frame of the text field expands or contracts in height by a ~2.5 points when toggling isSecureEntry
.
The two image assets used for the button measure 72x72 points, so I don't think the change is a result of changing the button's image.
We are using a custom font, so I thought that I may need to reset the font after each toggle of isSecureEntry
(the text field's caret's height is also affected). The steps that I took follow:
I have subscribed to
UITextField.textDidChangeNotification
s in order to set the font afterisSecureEntry
is toggled, assuming that the change of characters would cause the notification to be posted, but that doesn't seem to happen because the breakpoint placed at the selector is not triggered.I used the same logic to set the text field's font in the button's selector for the
touchUpInside
event, but that does't resolve the frame change either.
What may be causing the frame change of the text field when isSecureEntry
is toggled?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论