How to set a CGFloat to a UILabel's text property
-
22-09-2019 - |
Question
I have a UILabel
called optionsDisplayerBrushSizeLabel
who's text property I want to set to a CGFloat
: brushSizeVal
. I understand that the text property needs to be a string but I don't know how to convert a CGFloat to an NSString
.
Solution
You can try:
[NSString stringWithFormat: @"%.2f", myFloat];
OTHER TIPS
Tray this in swift
var a = String (stringInterpolationSegment:myFloat)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow