ios - How can I get a UILable height dynamically with HTML Content? -


i having 1 query. googled alot not able find out solution.

i using 1 api in getting content html string.

now want set data uitextview. calculate height of uitextview firstly using

cgsize constraint = cgsizemake(width-margin - (6 * 2), 20000.0f);     // size of text given cgsize made constraint     cgsize size = [lbltitle.text sizewithfont:[uifont fontwithname:custom_font_name size:lbltitle.font.pointsize] constrainedtosize:constraint linebreakmode:nslinebreakbywordwrapping];     int lines = size.height / lbltitle.font.pointsize + 1;      [lbltitle setframe: cgrectmake(lbltitle.frame.origin.x,lbltitle.frame.origin.y,width-margin, lbltitle.font.pointsize * lines)]; 

but when passing html content it's generating height more needed. solution calculate height of uitextview html text. using below code assign html text uitextview.

[txtdescription setvalue:data.desc forkey:@"contenttohtmlstring"]; 

thanks in advance.

you may use uiwebview intead of uitextview

here

nsdata* htmldata = [ content datausingencoding:nsutf8stringencoding];                 [webview loaddata:htmldata mimetype:@"text/html" textencodingname:@"utf-8" baseurl:[nsurl urlwithstring:@""]]; 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -