开发者

Set a 2-line title on a UINavigationItem on iOS?

I want to set a UINavigationItem's title such that it displays a 2 line title with both lines in a smaller font than normal. I've definitely seen this effect on other apps such as Mail, but I can't figure out how to get it to work.

I tried setting a prompt, that's definitely not what I want, I want the Nav Bar to stay the same height but have the text get smaller and allow two lines.

Is this possible by default or do I need my own custom view开发者_如何学运维 to achieve it?


You can set titleView to a custom view, for example a UILabel with the desired font. To make it a 2-line label, make sure you set numberOfLines to 2.


Other than setting the Prompt, what you are looking for is a custom navigationBar with a UILabel setting the numberOfLines property to 2. Alternatively, you can use 2 UILabel's.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜