问题
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
- clean project .
- 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