Lefora Free Forum
login join
Loading
468 views

Draw text centered in Custom view

Page 1
1–2
novice - member
13 posts

I have a custom view and I'm trying to draw some text centered, but when the text is too long, it truncates inserting an ellipsis character. I need the text to automatically break the line if the text doesn't fit in my custom view, so I will never miss any text.any ideas on how to do this?thanksAndres

?
288 posts

I believe the NSAttributedString class gives you good typographical control.  Remember in a custom view, you have to take responsibility for drawing, so you'll have to measure the string and your window and figure where to put the line breaks.  I don't think this is especially difficult and I suspect if you google a bit more, you'll probably find some library code to help you.  If you're really lucky, it'll be an Obj/C category which you can simply compile into your code.

I believe the position of the ellipsis can be varied and could occur at the begin, middle or end of the string you're drawing.

__________________
Page 1
1–2

Locked Topic


You must be a member to post in this forum

Join Now!