Sunday, 15 March 2015

iphone - How to get a UITextView to dynamically size it's self to it's content -



iphone - How to get a UITextView to dynamically size it's self to it's content -

i'm trying uitextview dynamically size it's self it's content. height of text view 100 700.

everything i've tried far hasn't worked.

i've tried next in viewdidload , in viewdidlayoutsubviews. here's code:

cgrect framedesc = self.descriptiondeal.frame; framedesc.size.height = self.descriptiondeal.contentsize.height; self.descriptiondeal.frame = framedesc; self.descriptiondeal.backgroundcolor = [uicolor redcolor];

i added background color see size of view , it's not sizing content.

i tried:

[self.descriptiondeal sizetofit];

also, not sure if it's affecting anything, in story uitextview laid out size set there. thought code above override it, somethings not working correctly.

thanks help

you should making size changes in text view's delegate's textviewdidchange: method

use http://stackoverflow.com/a/14956351/1311910 appropriate height.

iphone ios objective-c uitextview

No comments:

Post a Comment