How to find uiscrollview height from random string?
Given the string is randomly generated, some are shorts and some are long.
short e.g:
description dummy text.
long e.g:
description dummy text. description dummy text. description dummy text. description dummy text. description dummy text. description dummy text. description dummy text. description dummy text. description dummy text.开发者_如何学Python description dummy text. description dummy text. description dummy text.
I want to create a uiscrollview, with fix width, lets say: 250px, and the height is depend on how many lines that the given string put into the uiscrollview. How do I calculate the height required?
Please advise :D
Have a look at this page.
– sizeWithFont:forWidth:lineBreakMode:
You can find the height by this method.
精彩评论