Xcode Interface Builder frustration with small floats
| Originator: | me | ||
| Number: | rdar://12261748 | Date Originated: | 08-Sep-2012 04:18 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | 4.5 (4G144l) |
| Classification: | UI/Usability | Reproducible: | Always |
The other day I was adding a text field to show the pixel count of a view. I wanted to display the result as "4.3 MP", meaning 4.3 Megapixels (the underlying value was 4,300,000 as a CGFloat). As such I added an NSNumberFormatter to the bound text field, and tried to set its multiplier to 1e-6. Unfortunately, Xcode / IB wanted to "helpfully" truncate that to zero, which is nonsensical. With that having failed, I instead tried to use the runtime key-value attributes, adding a key-value pair of "multiplier" and number of 1e-6. There too, the number was truncated to zero. This behavior makes sense if the value were, say, a pixel offset. However, for arbitrary numbers (and in particular the NSNumberFormatter's "Multiplier"), clobbering values is frustrating and often incorrect.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!