ios - How do I add a UITextView to this UITableViewCell? -
ios - How do I add a UITextView to this UITableViewCell? -
i have uitableviewcell
dynamically sized based on content in it. in heightforrowatindexpath
follows:
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if (indexpath.section == 1 && indexpath.row == 1) { nsdictionary *fields = self.messagedetailsdictionary[@"fields"]; nsstring *celltext = fields[@"message_detail"]; uifont *cellfont = [uifont systemfontofsize:14.0]; cgsize constraintsize = cgsizemake(self.tableview.frame.size.width - 50.0f, maxfloat); cgsize labelsize = [celltext sizewithfont:cellfont constrainedtosize:constraintsize linebreakmode:nslinebreakbywordwrapping]; homecoming labelsize.height + 20.0f; } else { homecoming tableview.rowheight; } }
in cellforrowatindexpath
customise cell follows:
case 1:{ uitableviewcell *cell = [[uitableviewcell new] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"detailcell"]; if (cell == nil) { cell = [[uitableviewcell new] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"detailcell"]; } nsdictionary *fields = self.messagedetailsdictionary[@"fields"]; cell.selectionstyle = uitableviewcellselectionstylenone; cell.textlabel.linebreakmode = nslinebreakbywordwrapping; cell.textlabel.font = [uifont systemfontofsize:14.0]; cell.textlabel.numberoflines = 0; // means multiline cell.textlabel.text = fields[@"message_detail"]; homecoming cell; }
this works fine, want content of cell observe phone numbers, dates/times etc. think need have content in uitextview
within uitableviewcell
create possible.
how can dynamically size uitextview
, add together cell content modifying code above? sample code please answers because i've tried adding uitextview subview of cells contentview it's not working i'd expect.
you can utilize sizetofit
or sizethatfits:
methods resize uitextview
object
ios uitableview uitextview
Comments
Post a Comment