Xcode6: IBDesignable and IBInspectable with Object

2019-01-30 05:46发布

I have an Objective-C UI component that I'd like to make inspectable in Interface Builder with Xcode 6. Swift has the @IBDesignable and @IBInspectable declaration attributes. Are they available also in Objective-C? How are they used?

2条回答
萌系小妹纸
2楼-- · 2019-01-30 06:28

Code example:

#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface LOLView : UIView
@property (nonatomic) IBInspectable UIColor *someColor; 
@end
查看更多
孤傲高冷的网名
3楼-- · 2019-01-30 06:37

The equivalents are IB_DESIGNABLE and IBInspectable—see the documentation for Objective C examples.

Also, this year's WWDC video "What's New in Interface Builder" has its examples in Swift, but the presenter also mentions the Objective C equivalents in passing.

查看更多
登录 后发表回答