IBInspectable
Your Answer

That means, say for example you have the property text for the UILabel , you can use the user defined runtime attributes for changing its value. Wait, who would do that? You can do that in the u. If you want to achieve this, you can add a category for the CALayer with a UIColor property and you can write your own logic to change its borderColor. If you give a u.

Expanding User-Defined Runtime Attributes in Xcode with Objective-C

In the previous Xcode, it will raise a invalid argument exception and crash. Like Like.


  • ttpod for blackberry curve 2.
  • samsung rex 80 apps whatsapp?
  • plants vs zombies iphone ipad sync?
  • uc browser for android galaxy y duos free download!

Actually, never mind! You have to create a custom class. Please refer the Note section in this blog.

About Kratin

You are commenting using your WordPress. You are commenting using your Twitter account. You are commenting using your Facebook account.


  • racing moto 2 for nokia 500.
  • iOS localization tricks for Storyboard and NIB files — Xebia Blog.
  • Post navigation;

Notify me of new comments via email. Notify me of new posts via email. They provide a powerful mechanism for configuring any key-value coded property of an instance in a NIB, XIB, or storyboard:.

The Objective-C Category that Makes It Possible

While powerful, runtime attributes can be cumbersome to work with. IBInspectable properties solve this problem outright: For example, these properties in a UIView subclass update the backing layer with their values:. Note that Xcode goes the extra mile here—property names are converted from camel- to title-case and related names are grouped together:. Since inspectable properties are simply an interface on top of user-defined runtime attributes, the same list of types is supported: Those already familiar with runtime attributes will have noticed a bit of trickery in the example above.

This allows seeing how your custom views will appear without building and running your app after each change.

IBInspectable / IBDesignable - NSHipster

Your initializers, layout, and drawing methods will be used to render your custom view right on the canvas:. Combined with IBInspectable properties, a designer or developer can easily tweak the rendering of a custom control to get the exact result she wants.

Any changes, whether made in code or the attribute inspector, are immediately rendered on the canvas. Moreover, any problems can be debugged without compiling and running the whole project.

There are two ways to add code for this special context:.