当我将图像设置为IBImageView时,构建失败 [英] When I set the image to IBImageView, get build failed

查看:102
本文介绍了当我将图像设置为IBImageView时,构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IBImageView是这样的:

My IBImageView is like this:

LMLCommonIBImageView.h中:

#import <UIKit/UIKit.h>

IB_DESIGNABLE
@interface LMLCommonIBImageView : UIImageView

@property (nonatomic, assign)IBInspectable CGFloat borderWidth;
@property (nonatomic, strong)IBInspectable UIColor *borderColor;

@property (nonatomic, assign)IBInspectable CGFloat cornerRadius;

@end

LMLCommonIBImageView.m文件中:

#import "LMLCommonIBImageView.h"

@implementation LMLCommonIBImageView


- (void)setBorderWidth:(CGFloat)borderWidth {

    if (borderWidth < 0) return;

    self.layer.borderWidth = borderWidth;
}

- (void)setBorderColor:(UIColor *)borderColor {

    self.layer.borderColor = borderColor.CGColor;
}


- (void)setCornerRadius:(CGFloat)cornerRadius {

    self.layer.cornerRadius = cornerRadius;
    self.layer.masksToBounds = cornerRadius > 0;
}

我收到此错误:

IBDesignables构建失败

IBDesignables Build failed

推荐答案

尝试一下

  1. 清理项目.
  2. 然后在情节提要中转到编辑器"菜单,然后执行刷新所有视图";等待构建完成.

这篇关于当我将图像设置为IBImageView时,构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆