I am searching about drawing bordered text on UIView.
Implemented following method :
- (void)drawRect:(CGRect)rect {
//TODO draw bordered text here.
}
How to draw it ?
I mean each letter is bordered of whole text.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To display bordered text (if I understand correctly what you want) you should set text drawing mode to
kCGTextFillStroke(and set appropriate values for text drawing parameters, such as stroke and fill colors etc)Edit: As Quartz does not work well with unicode, to draw unicode strings you’ll need to use other APIs. I managed to draw “bordered” unicode string using NSAttributedString and
OHAttributedLabel(thanks to this answer for that custom control). Sample code to get required string in some view controller:Note that you’ll need to link with CoreText.framework to make that work, and code uses some convenience methods provided in
OHAttributedLabelimplementation