开发者

How to make multi-line text on the iPhone?

开发者 https://www.devze.com 2022-12-30 22:52 出处:网络
Would I use a UILabel for that? Or is the开发者_StackOverflow中文版re something better?It depends on what you want to achieve. If you just want a multi-line label, then you can use UILabel with the nu

Would I use a UILabel for that? Or is the开发者_StackOverflow中文版re something better?


It depends on what you want to achieve. If you just want a multi-line label, then you can use UILabel with the numberOfLines parameter set to something other than 1 (set it to zero if you don't care how many lines are used). If you need to let the user edit the text, then a UITextView is the way forward. Line breaks are indicated using the \n character, not the /n sequence as Emil incorrectly wrote.


You can use a UITextView, and write \n where you want the new lines.

Hey!\nHow are you?\n\n\nYOU: I am fine.\nME: That's great! will display:

Hey!
How are you?

YOU: I am fine
ME: That's great!
0

精彩评论

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