How to draw a currency symbol in a custom label using CGContextShowTextAtPoint method in draw rect.
Here the symbol is in string format.
Any help!!
Thanks
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.
You have to resort to
Cstyle strings, since this is whatCGContextShowTextAtPoint()requires. In order to correctly handle the locale (the currency symbol changes with the locale) you must usesetlocale(), then you format your string usingstrfmon()and finally you pass the string created withstrfmon() toCGContextShowTextAtPoint().Documentation is available as follows from the terminal:
EDIT/UPDATE: For your information,
strfmon()internally usesstruct lconv. The structure can be retrieved with the functionlocaleconv(). Seeman 3 localeconvfor a detailed description of the fields available in the structure.for instance, try the following simple C program setting different locales
The following uses
localeconv():