开发者

How to create auto resizing input bar

开发者 https://www.devze.com 2023-01-07 14:31 出处:网络
I want to impleme开发者_运维问答nta in-app chat view like the following pic. http://img408.imageshack.us/img408/4057/img0139.png

I want to impleme开发者_运维问答nt a in-app chat view like the following pic. http://img408.imageshack.us/img408/4057/img0139.png

How can I implement the input bar? As I cannot found any resourece on internet.

Thanks.

Best,

Dante


Don't count newline chars, since you will miss lines added by long sentences, but use NSString's sizeWithFont methods. See Documentation for NSString sizeWithFont:forWidth:lineBreakMode: method (in the iPhone SDK)?

Then resize all elements appropriately (no, this will not happen by itself, you have to do it).


Use a UITextView, check for new line character in textViewDidBeginEditing and increase the height of the text view (and the background view if you have one).

0

精彩评论

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