私はtableviewを使用しています。私は1つのセルを使用して多数のcolumns.My列番号を作成していますので、cellForRowAt関数内でforループを使用して列を作成する必要がありました。私のセル内の私のラベルの間にいくつかのスペースを与えます。このコードは、ラベルの先頭にスペースを挿入しますが、ラベルの最後を削除します。Unicode非改行スペースが削除されました。
let spaces = String(repeating:"\u{00A0}",count : columnSpaceCount)
if globalSubviewHeaderStructArray[i].type == "numeric"{
if globalSubviewHeaderStructArray[i].digitsAfterComma != "0" {
var dataNumber = applyComma(comma : globalSubviewHeaderStructArray[i].digitsAfterComma , data : globalSubviewDataArray[indexPath.row][i])
var newString = "\(spaces)\(checkCurrency(option: globalSubviewHeaderStructArray[i].currency, data: dataNumber))\(spaces)"
newLabel.text = newString
}else{
var newString = "\(spaces)\(checkCurrency(option: globalSubviewHeaderStructArray[i].currency, data: globalSubviewDataArray[indexPath.row][i]))\(spaces)"
newLabel.text = newString
}
}else{
var newString = "\(spaces)\(checkCurrency(option: globalSubviewHeaderStructArray[i].currency, data: globalSubviewDataArray[indexPath.row][i]))\(spaces)"
newLabel.lineBreakMode = .byTruncatingMiddle
newLabel.text = newString
}
は、なぜあなたはラベルテキストの末尾にスペースが必要なのでしょうか? – rmaddy
ユーザーはラベルの表示を変更することができます。たとえば、アライメントやフォントや色を変更することができます。左に約2つのラベルを置き、右に1つ、左に1つ並べます。 .btw列の幅はデータの長さと同じになりますので、列幅を広くすることはできません。 – theduman
WenあなたはWord文書を編集するにはスペースバーを使用しますか?または、余白のサイズなどを更新しますか...ここでは行いません。 @mattのように、以下のようにラベルの周りにマージンを入れて配置などを修正します。 – Fogmeister