Xcode: Interface Builder Can’t Use Constants
| Originator: | SlaunchaMan | ||
| Number: | rdar://17870121 | Date Originated: | 31-Jul-2014 10:17 AM |
| Status: | Duplicate/2663744 | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 5.1.1 (5B1008) |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary: When entering data into fields in Interface Builder, it’s impossible to use constants defined in code. Instead, we must copy and paste them into the field, requiring us to modify values in two places to share values from IB to code. Steps to Reproduce: 1. Create an iOS project with a view controller that has an associated .XIB file. 2. In the view controller’s header, declare a constant: extern const CGFloat kLabelMargin; 3. In the view controller’s implementation, give the constant a value: const CGFloat kLabelMargin = 10.0f; 4. Open the .XIB file and add a label. For its frame’s X value, enter “kLabelMargin” into the text field. Expected Results: Xcode autocompletes the text of kLabelMargin as you enter it, and the value is used to construct the label’s frame. Actual Results: Xcode won’t let you exit the text field until a valid numeric value is entered. Regression: All versions of Xcode. Notes: This would be useful for strings, layout constants, and would also help track down hard-to-debug views where instead of properties, the developer uses tags to identify views. In general, allowing us to have constants in one place would allow designers to quickly tweak values and see results in views that use nibs as well as ones created programmatically.
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!