2016-06-27 4 views
1
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 
} 

UITableViewCelltextAlignmentを作成して使用しています。そうだが、うまくいかない。UITableViewCellテキストアライメントセンター

ところで、赤色がうまく機能します。

私の環境はiOS9で、swiftです。

ありがとうございます。

enter image description here

答えて

1

代わり

let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "ChatCell") 
+0

1.どのような 'VALUE1' という意味のこの

let cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "ChatCell") 

を試してみてください? 2. No.1を適用した後に字幕を使用できますか? –

+0

これは、デフォルトのテーブルビューセルのスタイルとは異なります。 –

+0

また、.Defaultを試してみてください。 –