When I set the image to IBImageView, get build failed

◇◆丶佛笑我妖孽 提交于 2019-12-23 04:28:38

问题


My IBImageView is like this:

In 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

In LMLCommonIBImageView.m file:

#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;
}

I get this error:

IBDesignables Build failed


回答1:


Try this

  1. clean project .
  2. then In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed .


来源:https://stackoverflow.com/questions/43515419/when-i-set-the-image-to-ibimageview-get-build-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!