ios - Interface Builder 中的 Objective C 类类别
<p><p>我在 Objective C 中创建了一个类类别:</p>
<pre><code>#import <UIKit/UIKit.h>
@interface UIView (LayerProperties)
@property IBInspectable (nonatomic) CGFloat cornerRadius;
@property IBInspectable (nonatomic) CGFloat borderWidth;
@property IBInspectable (nonatomic, strong) UIColor *borderColour;
@end
</code></pre>
<p>如果我导入标题,这一切都很好并且有效。添加 UIView 时,如何在 Interface Builder 中显示此类别?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个。界面生成器中的 KVC。也许你需要子类</p>
<p> <a href="/image/6GUl8.png" rel="noreferrer noopener nofollow"><img src="/image/6GUl8.png" alt="enter image description here"/></a> </p>
<p>或者创建子类并使用 <code>IBInspectable/IBDesignable</code>
(<a href="http://nshipster.com/ibinspectable-ibdesignable/" rel="noreferrer noopener nofollow">http://nshipster.com/ibinspectable-ibdesignable/</a>)</p></p>
<p style="font-size: 20px;">关于ios - Interface Builder 中的 Objective C 类类别,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37177924/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37177924/
</a>
</p>
页:
[1]