Xcode - Default values for IBInspectable are not shown in IB

Originator:dino.angelov
Number:rdar://19044397 Date Originated:20.11.2014
Status:Closed Resolved:No
Product:Developer Tools Product Version:Xcode 6.1 (6A1052d)
Classification:Duplicate Reproducible:Yes
 
For custom subclasses, @property[ies] defined as IBInspectable are correctly shown in IB, but even after setting a default value from both within initWithFrame and initWithCoder, the default value is not reflected in IB.

Attached[1] is a screenshot of the values as shown in IB, and sample subclass to demonstrate the problem.

Steps to Reproduce:
1) Open Xcode
2) Make a new subclass of NSView
3) Add subview in IB/XIB file, set it's class to the new subclass
3) In the subclass .h, add @properties that are have IBInspectable
4) Confirm the property is displayed in Xcode's Attributes Inspector
5) In the .m, re-implement the initWithCoder and initWithFrame methods, and set the value of  your @properties, as to give them a default value
6) In the XIB, none of the default values are shown

Expected Results:
Once you've setup the default value for your properties from initWithCoder or initWithFrame, their value should be displayed as default in Interface Builder.

Actual Results:
For example, a color displays as a white rectangle with a red crossed line, no matter what you set as a default. Numbers display a spinner/number control with no default entry.

[1] http://dew.dangelov.com/external/rdar-19044397-screenshot.png
     http://dew.dangelov.com/external/rdar-19044397-samplecode.tar.gz

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!