문제

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top