Search code examples
iosxcodeenumsuistoryboardxcode-storyboard

Storyboard user defined runtime attributes with enum


Does anyone know if it's possible to set user defined runtime attributes in Xcode's storyboard with an enum's name (not value).

I tried String and Number types, neither of them works. Setting it programatically is an option, I know.

In other words, for example I want to able to set the textAlignment attribute of UILabel to NSTextAlignmentCenter without knowing NSTextAlignmentCenter's real numeric value (1).


Solution

  • It is possible only if Xcode provides you with interface for that. For example, there're buttons to switch between NSTextAlignment for UILabel.

    And, no, there's no way to set any enum values - as long as Xcode doesn't provide functionality like that for editing property lists.

    It will become possible, when property lists will support enums