您好我正在嘗試根據textlabel和detailtextlabel動態更改我的行高度。基於文本標籤和細節文本標籤的行高 - 物鏡c
以下是我的代碼:
NSString *title = [NSString stringWithFormat:@"%@%@%@",_note.committeeStaffName,@" - ",_note.dateCreated];
cell.textLabel.text = title;
cell.detailTextLabel.text = _note.note;
我試圖調整基礎上,爲textLabel和detailTextLabel表的行的高度。 textLabel不會超過一行。 detailTextLabel包含不同長度的大文本。我已經閱讀了委託方法heightForRowAtIndexPath的幾個例子,但是他們都沒有清楚地說明在方法heightForRowAtIndexPath中應該做什麼以及在cellForRowAtIndexPath中應該執行什麼代碼。任何人都可以清楚地解釋一下代碼應該在兩個方法heightForRowAtIndexPath和cellForRowAtIndexPath中進行調整,以便根據包含textLabel和detailTextLabel的內容調整表格行的高度。
[根據文本量更改UITableViewCell高度]的可能重複(http://stackoverflow.com/questions/9827126/change-the-uitableviewcell-height-according-to-amount-of-text) – CodaFi 2013-03-07 00:34:47