1

.rowHeightのセルのサイズを変更するのに非常に苦労してい.toDoListTableます。から受け取った文字列は、UITextfield各行の最後で切り取られています。文字列は UITextField. 私のコードは次のとおりです。

override func viewDidLoad() {
    super.viewDidLoad()


        toDoListTable.estimatedRowHeight = 45.0

        toDoListTable.rowHeight = UITableViewAutomaticDimension


    }

}

それでも、まだテキストが途切れています。助言がありますか?また、私のコードは正しい場所にありますか?

から提供されるテキストの量に合わせて、内部のコンテンツを調整したいと考えていますUITextField

編集: を追加して問題を解決しましcell.textLabel?.numberOfLines = 0た。

4

3 に答える 3

3

これを使用して、行の高さを設定します。

override func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat
    {
         return 50 //your height
    }

ドキュメンテーション:

https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html

于 2015-02-13T06:14:27.490 に答える
3
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat{
    return 30 // height you want to set.
}
于 2015-02-13T06:33:21.013 に答える
1

遅れていることはわかっていますが、自分の質問に正しく答えたかったのです。

私は単に追加しました:複数行の無制限のテキストを許可する関数にcell.textLabel?.numberOfLines = 0cellForRowAtIndexPath

于 2015-03-17T02:13:47.933 に答える