Interface Builder's User Defined Runtime Attributes not accepting floats?
Asked Answered
V

1

13

I created an NSView subclass that has a float property and I'd like to set it in Interface Builder. In the User Defined Runtime Attributes section the only suitable Type is Number. But if I want to enter a decimal number (either using . or , as delimiter) it just rounds to the nearest integer. Is this a bug or on purpose? How can I define a float instead of an Integer?

Vicinal answered 15/5, 2012 at 19:8 Comment(0)
E
26

Use a string type and enter your value like this

0.7
Elo answered 23/5, 2012 at 1:12 Comment(6)
Wow, why didn't I think of doing this? Thanks.Vicinal
Thank you!!. Like DrummerB, this was driving me insane. And the answer is so simple.Mare
@DrummerB: because it is completely illogic.Pillbox
Huh. This actually works. How fantastically ugly, even by the standards I expect of Xcode. Is this madness documented anywhere? How in the world did you discover it, otherwise?Greengrocery
It is not documented. I found it when drinking.Elo
@MarkAmery What standards are you talking about? This is completely illogic, just as many other things with XCode. Like Swift code suggestions, for example.Logbook

© 2022 - 2024 — McMap. All rights reserved.