Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift : How to center cell text

I have a problem with my swift APP.

In my TableViewCell function i wrote

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

if i wrote

cell.textAlignment red line appear and say "textAlignment in unavailable: API deprecated"
like image 472
Antonello Rossi Avatar asked Dec 01 '22 13:12

Antonello Rossi


1 Answers

The correct answer for people using Swift 4 would be:

cell.textLabel?.textAlignment = .center
like image 142
Thomas Avatar answered Dec 06 '22 23:12

Thomas