NSTextField:居中对齐时不去除尾随空格 [英] NSTextField: do not strip trailing spaces while center-aligned

查看:117
本文介绍了NSTextField:居中对齐时不去除尾随空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对静态文本NSTextField的探索持续进行.

My crusade against static text NSTextField goes on.

今天的问题是:为什么居中对齐的NSTextField -s甚至敢于从给出的行中删除尾随空格?他们为什么不删除前导空格?

The question for today is: Why do center-aligned NSTextField-s even dare to strip trailing spaces from the lines they are given? Why don`t they strip leading spaces then?

但是,最重要的是,如何阻止他们屠杀我的文字?

But, most importantly, how do I stop them from butchering my text?

PS:如果您想知道我为什么要这么做,请参阅此

P.S.: if you`re wondering why I want that, refer to this question of mine.

P.S.#2:似乎类似的问题已经被问到了,但是没有用.

P.S.#2: seems like a similar question has been asked before — to no avail, though.

推荐答案

基于快速实验:选择标签字段,然后在属性窗格中将LayoutTruncates更改为Scrolls,文本现在应居中考虑到尾随空格.

Based on a quick experiment: Select the label field and in the attributes pane change the Layout from Truncates to Scrolls the text should now centre taking into account the trailing spaces.

或者您可以从可编辑的文本字段开始,然后关闭边框,绘制背景和可编辑的行为设置.

Or you can start with an editable text field and turn off the border, draws background and editable behavior settings.

HTH

这篇关于NSTextField:居中对齐时不去除尾随空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆