When I set the image to IBImageView, get build failed
Asked Answered
B

1

0

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

enter image description here

Blen answered 20/4, 2017 at 9:22 Comment(4)
clean project and then In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed and errors should be gone.Dys
@KKRocks, Thank you sir, you save my day.Blen
Welcome.......@qg_javaDys
is this working ? so do accept my answer.Dys
D
0

Try this

  1. clean project .
  2. then In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed .
Dys answered 20/4, 2017 at 10:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.