5

I am looking for a way to change the textField text alignment. I have tried it with

cell.textField.textAlignment = .Left

but that doesn't change the alignment. It will always stay right aligned. I was wondering why this was the default, as Apple themselves use left aligned text inputs in most, if not all places.

4

1 回答 1

9

对于尤里卡来说有点不同。您必须使用单元格更新回调。关于更改对齐方式的文档没有很好的记录。但是这里确实提到更改颜色或字体,您必须使用.cellUpdate.因此,我相信这项工作对您有用:

let row = TextRow() {
    row.title = "Field:"
}.cellUpdate { cell, row in
    cell.textField.textAlignment = .left
}
于 2016-07-13T17:05:47.560 回答