[英]how to set textfield size fix macos swift
I have one textfield "A" with width 150. but whenever I am passing more characters to textfield "A", it is getting overlapped on other textfield "B" characters.我有一个宽度为 150 的文本字段“A”。但是每当我将更多字符传递给文本字段“A”时,它就会与其他文本字段“B”字符重叠。
I want textfield "A" to be fixed size and scrollable(mostly right and left).我希望文本字段“A”是固定大小和可滚动的(主要是左右)。
Thanks in advance.提前致谢。
I have added the Auto-Layeouts to my textfields and I have followed below steps:我已将自动布局添加到我的文本字段,并按照以下步骤操作:
1) Selected the label. 1) 选择标签。
2) Go to attributes inspector. 2)转到属性检查器。
3) Select 'Line Breaks' and choose an option Truncate Tail 3)选择“换行符”并选择一个选项截尾
4) now I can see the text without overlapping with another textField. 4) 现在我可以在不与另一个 textField 重叠的情况下看到文本。
Note : But still I am not able to view/Scoll the full text.注意:但我仍然无法查看/整理全文。
You should use Auto-Layeout in your storybook.你应该在你的故事书中使用自动布局。 Set fixed width, trailing space and leading space to your text field.
为文本字段设置固定宽度、尾随空格和前导空格。
Just found this piece of code.刚刚找到这段代码。 It might help you
它可能会帮助你
scrollView.hasHorizontalScroller = true
textView.maxSize = NSMakeSize(CGFloat(FLT_MAX), CGFloat(FLT_MAX))
textView.isHorizontallyResizable = true
textView.textContainer?.widthTracksTextView = false
textView.textContainer?.containerSize = NSMakeSize(CGFloat(FLT_MAX), CGFloat(FLT_MAX))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.