c# - iOS designing UITableViewCell with customizable content -


i've been fiddling issue several days now, , cannot seem right.

i trying construct uitableview should similar following mockup:

 ios design issue

  • outer layout: uitableviewcell
  • red layout: stand-alone .xib uiview single uiview
  • blue layout: inner layout. several of these should able exist inside single red layout, on top of each other, described in second cell.

this is, far can tell, optimal way lay out on ui. cannot seem height of cell (for getheightforrow method), no matter try.

loading , adding views isn't problem, problem after they're loaded, fill different ui elements data, , size of them.

i have tried using sizetofit, elements seems have effect on, uilabels. when uilabel's frame changes 300 height , call sizetofit on ui containing label, (the uiview) still remains @ 320x100. means when it's rendered, it's looking wrong.

the way i'm trying calculate height similar point 4 on accepted answer @ https://stackoverflow.com/a/18746930/2520789 . is, creating single cell in memory, , filling data each row, , getting height on cell.

use this

-(cgfloat) heightfortext:(nsstring *)text withwidth:(cgfloat) textwidth{      cgsize constraint = cgsizemake(textwidth, 20000.0f);     cgrect rect = [text boundingrectwithsize:constraint                        options:(nsstringdrawinguseslinefragmentorigin|nsstringdrawingusesfontleading)                     attributes:@{nsfontattributename:[uifont systemfontofsize:14]}                        context:nil];     cgfloat height = rect.size.height;      height = ceilf(height); //    nslog(@"height %f", height);     return height; } 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -