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?
Asked
Active
Viewed 2,405 times
1 Answers
26
Use a string type and enter your value like this
0.7

William Entriken
- 37,208
- 23
- 149
- 195
-
Wow, why didn't I think of doing this? Thanks. – DrummerB May 23 '12 at 12:30
-
Thank you!!. Like DrummerB, this was driving me insane. And the answer is so simple. – So Over It Mar 07 '13 at 03:47
-
5@DrummerB: because it is completely illogic. – MrTJ Jul 02 '13 at 07:39
-
1Huh. 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? – Mark Amery Sep 09 '13 at 14:11
-
5It is not documented. I found it when drinking. – William Entriken Sep 12 '13 at 14:37
-
@MarkAmery What standards are you talking about? This is completely illogic, just as many other things with XCode. Like Swift code suggestions, for example. – Azurlake Mar 01 '17 at 12:18