[英]IBInspectable and default values in objective-c, black coloured view
我在我的Objective-C项目中使用IBInspectables。 我不会为这些设置一些默认值。 这不是简单的事情,因为只是像您可以迅速设置默认值一样,所以我正在尝试通过init方法来实现,如下所示:
@interface PushButtonView ()
@property (nonatomic, strong) IBInspectable UIColor *fillColor;
@property IBInspectable BOOL isAddButton;
@end
@implementation PushButtonView
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
self = [super initWithCoder:aDecoder];
if(self){
self.fillColor = [UIColor blueColor];
self.isAddButton = YES;
}
return self;
}
这使我可以根据需要更改接口构建器中的值。 但是,如果我选择default作为按钮的fillColor,则它在界面生成器中显示为黑色,而不是蓝色。 有什么想法我在这里做错了吗? 任何指针都很棒。
您无法更改默认颜色。 因为UIButton
上的颜色是黑色。 您的按钮确实会显示为黑色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.