Comment définir une CGFloat à une propriété de texte UILabel
-
22-09-2019 - |
Question
J'ai un UILabel
appelé optionsDisplayerBrushSizeLabel
qui est la propriété de texte que je veux mettre un CGFloat
: brushSizeVal
. Je comprends que la propriété de texte doit être une chaîne, mais je ne sais pas comment convertir un CGFloat à un NSString
.
La solution
Vous pouvez essayer:
[NSString stringWithFormat: @"%.2f", myFloat];
Autres conseils
dans ce bac rapide
var a = String (stringInterpolationSegment:myFloat)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow