我有一个自定义UIView
课程。在里面我已经声明了一个 IBOutlet
属性UIImageView
。
#import <UIKit/UIKit.h>
@interface SettingItem : UIView{
}
@property (strong, nonatomic) IBOutlet UIImageView *myImage;
@end
现在我正在使用故事板。有一个视图控制器。我拖到UIView
视图控制器。我拖了一个UIImageView
作为上面的子视图UIView
。我将“SettingItem”类设置为UIView
来自情节提要。SettingItem
我通过从实用程序窗口的插座正常拖动将插座连接到 myImage 。
SettingItem
执行
#import "SettingItem.h"
@implementation SettingItem
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self baseInit];
}
return self;
}
-(id) initWithCoder:(NSCoder *)aDecoder{
self = [super initWithCoder:aDecoder];
if (self) {
// Initialization code
[self baseInit];
}
return self;
}
- (void) baseInit{
NSLog(@"myImage %@"self.myImage);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
现在我的问题myImage
总是nil
,上面NSLog
只是为出口打印(null)
。我检查了情节提要中的视图并检查了它的出口参考和指向myImage
. 我错过了一些东西。我搜索了帮助,但找不到任何解决方案。
你能指出我做错了什么吗?