How to set a CGFloat to a UILabel's text property
I have a UILabel
calle开发者_开发问答d 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)
精彩评论