noodlez
noodlez

Reputation: 89

IB_DESIGNABLE and IBINSTECTABLE UIImageView

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?

Upvotes: 0

Views: 1290

Answers (1)

Ashok Parthiban D
Ashok Parthiban D

Reputation: 31

Use UIImage instead UIImageView.

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

func setbackImage(){ self.image = backImage}

Upvotes: 3

Related Questions