ios - Resizing UITextView in custom UITableViewCell -


i have custom uitableviewcell , i'm trying resize uitextview inside based on content size. i'm on ios7 , using autolayout.

i've tried using following:

[cell.question setscrollenabled:yes]; [cell.question sizetofit]; [cell.question setscrollenabled:no]; 

and

- (cgrect)textviewheightforattributedtext: (nsattributedstring*)text andwidth: (cgfloat)width {     uitextview *calculationview = [[uitextview alloc] init];     [calculationview setattributedtext:text];     cgsize size = [calculationview sizethatfits:cgsizemake(width, flt_max)];     cgrect finalframe = cgrectmake(0, 0, width, size.height);     return finalframe; } 

from different posts. i'm able resize frame. issue i'm not able see change visibly. in sense, when log it, can see change. uitextview doesnt resize. cant find autolayout dependencies either.

when disabled autolayout, seems work. how do this, enabling autolayout?

thanks.

edit

here's uitextview constraints

screenshot

you have calculation in

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath; 

method , resize cell height accordingly.

if got it, it's okay. or if need code sample, ask again. think got !

updated

    - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {             uitextview *temptv = [[uitextview alloc] init];             [temptv settext:@"your text"];             cgfloat width = self.tableview.frame.size.width - text_origin_x - text_end_x;             cgsize size = [temptv sizethatfits:cgsizemake(width, max_height)];             return (text_origin_y + size.height + text_bottom_space);     } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -