Reputation: 133
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "ChatCell")
// put the data
cell.textLabel!.textColor = UIColor.redColor()
cell.textLabel!.textAlignment = .Right
cell.textLabel!.text = array[indexPath.row]
return cell
}
I'm creating and using default UITableViewCell
with textAlignment
. Right, but it doesn't work.
By the way, Red color works well.
My environment is iOS9
with swift
.
Thank you.
Upvotes: 1
Views: 1434
Reputation: 2640
Try this
let cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "ChatCell")
instead of
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "ChatCell")
Upvotes: 3