【问题标题】:When I set the image to IBImageView, get build failed当我将图像设置为 IBImageView 时,构建失败
【发布时间】:2017-04-20 09:22:54
【问题描述】:

我的 IBImageView 是这样的:

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 构建失败

【问题讨论】:

  • 清理项目,然后在情节提要中转到编辑器菜单并刷新所有视图;等待构建完成,错误应该消失。
  • @KKRocks,谢谢你,先生,你拯救了我的一天。
  • 欢迎......@qg_java
  • 这行得通吗?所以请接受我的回答。

标签: ios storyboard ibdesignable


【解决方案1】:

试试这个

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

【讨论】:

    猜你喜欢
    • 2016-02-26
    • 1970-01-01
    • 2019-07-15
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-22
    相关资源
    最近更新 更多