tableview - iPhone - adjust size of table view according to text -


is there way adjust size of table view , text wrap in iphone? i'm using following code, , succeeds in adjusting height of cell, text doesn't wrap, ends "...."

- (cgfloat)tableview:(uitableview *) tableview heightforrowatindexpath: (nsindexpath *)indexpath    {     cgsize cellheight;          city *thiscity = [cities objectatindex:indexpath.row];         nsstring * mystring = thiscity.cityname;          cellheight = [mystring sizewithfont:[uifont systemfontofsize:13.0f] constrainedtosize:cgsizemake(300.0, 1000.0) linebreakmode:uilinebreakmodewordwrap];         return cellheight.height + 20; } 

there 2 things here:

  1. wrapping of text in displayed label - have define uilabel how looks container - how many rows can have, wrap , of course how big is. can either in code or in interface builder (depending on if using own custom cell)

  2. you can change uitableview's width either in interface builder or in code (mytableview.frame = cgrectmake(x,y,width,height)) notice if using uitableviewcontroller view controller - cannot adjust width of table view


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -