ios - Resizable UITextView to fit its content -


i have done resizing uitextview fit content using following code snippet (source).

uitextview* textview = [[uitextview alloc]initwithframe:cgrectmake(0.0f,0.0f,300.0f,10.0f)]; [self.view addsubview:textview];  textview.text = @"lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s";  cgrect frame = textview.frame; frame.size.height = textview.contentsize.height; textview.frame = frame; 

my problem don't want create uitextview programatically. when add interface builder , reference through @property, above code doesn't work. frame returns null. i've put code inside viewdidload assume happens because uitextview's been initialized or added view controller yet(?)

is there way accomplish without creating uitextview programatically?

you don't this

uitextview* textview = [[uitextview alloc] initwithframe:cgrectmake(0.0f,0.0f,300.0f,10.0f)]; [self.view addsubview:textview]; 

if have property hooked in interface builder. remove lines , set in ib, , should work fine.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -