我在IB中创建了自定义uiview并为其设置了类。在自定义uiview中初始化控件
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface myView : UIControl {
IBOutlet UITextView *textView;
}
@end
#import "myView.h"
@implementation myView
- (void)commonInit
{
[textView setText:@"lajsdfklasdfjl"];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super initWithCoder:aDecoder])
{
[self commonInit];
}
return self;
}
-(id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame])
{
[self commonInit];
}
return self;
}
@end
我把一个TextView文本这种观点在IB,并将其链接到IBOutlet中IUTextView * TextView的。 当我在UIViewController上拖动这个自定义视图时(从IB库中的类标签),视图是空的。 - (id)initWithCoder:(NSCoder *)aDecoder正在调用,但textView为null。 有什么不对?由于