Swift:如何将单元格文本居中

Ant*_*ssi 2 cell text-alignment uitableview swift

我的快捷APP有问题.

在我写的TableViewCell函数中

let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath:indexPath) as MyCell
cell.setMyCell(self.data[0]["content"]!) 
Run Code Online (Sandbox Code Playgroud)

如果我写的

cell.textAlignment red line appear and say "textAlignment in unavailable: API deprecated"
Run Code Online (Sandbox Code Playgroud)

Tho*_*mas 10

使用Swift 4的人的正确答案是:

cell.textLabel?.textAlignment = .center
Run Code Online (Sandbox Code Playgroud)