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
.
How to set a CGFloat to a UILabel's text property
You can try:
[NSString stringWithFormat: @"%.2f", myFloat];
I think there should [NSString stringWithFormat: @"%.2f", myFloat]; for floats. –
Ghassan
you are entirely correct, I've edited my answer, sorry, a typo. –
Merari
Tray this in swift
var a = String (stringInterpolationSegment:myFloat)
© 2022 - 2024 — McMap. All rights reserved.