How to set a CGFloat to a UILabel's text property
-
22-09-2019 - |
문제
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
.
해결책
You can try:
[NSString stringWithFormat: @"%.2f", myFloat];
다른 팁
Tray this in swift
var a = String (stringInterpolationSegment:myFloat)
제휴하지 않습니다 StackOverflow