0

I'm trying to add a custom property to my subclass of UIImageView. The property type is of UIImageView. I have success with other data types, UIColor, int, etc. But UIImageView just doesn't appear in the custom fields of the interface builder and I can't access it via code.

#import <UIKit/UIKit.h>


IB_DESIGNABLE
@interface newLayerController : UIImageView

@property (nonatomic, copy) IBInspectable UIImageView *imageSheet;

  - (void)drawShape:(CGPoint)point;
  - (void)endTouch:(CGPoint)point;
  - (void)startTouch:(CGPoint)point;

@end

Anyone know a quick fix?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
noodlez
  • 89
  • 8
  • 2
    You can not have ibinspectable uiimageview. You can however have @property (nonatomic, copy) IBInspectable UIImage* image; which in your code you can assign to the view. – Predrag Samardzic Nov 25 '17 at 17:16

1 Answers1

3

Use UIImage instead UIImageView.

@IBInspectable var backImage: UIImage = UIImage() {
    didSet{
        setbackImage()
    }
}

func setbackImage(){ self.image = backImage}