开发者

How to find uiscrollview height from random string?

开发者 https://www.devze.com 2023-03-22 17:44 出处:网络
Given the string is randomly generated, some are shorts and some are long. short e.g: description dummy text.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号