更改自定义UIView的UILabel文本不起作用

use*_*013 1 objective-c xib uiview ipad ios

我有一个UIView使用xib构建的自定义文件CustomModuleUIView,其中包含一个包含标签和按钮的文件所有者.我在我的Rootviewcontroller中调用了这个自定义视图,我成功地使用initWithCoder方法显示它.问题是,我不能默认的文本改变UILabel既不是来自customMouleUIView也不能从根本ViewController.我找到了一个示例,它告诉我进行自定义初始化,initWithCoder但它对我不起作用,没有任何变化,没有任何错误,它显示默认文本.

这是我的自定义UIView xib 在此输入图像描述

这是我的根视图控制器 在此输入图像描述

这是我的代码哦定制UIView .h

 #import <UIKit/UIKit.h>

@interface ModuleCustomUIView : UIView

-(void) setup;
@property (weak, nonatomic) IBOutlet UIImageView *_moduleIcon;
@property (retain, nonatomic) IBOutlet UILabel *_moduleName;
- (IBAction)openDemo:(id)sender;
- (IBAction)close:(id)sender;
@property (weak, nonatomic) IBOutlet UIImageView *_moduleImage;
@property (strong, nonatomic) IBOutlet UILabel *_positionLabel;

@end
Run Code Online (Sandbox Code Playgroud)

.m的代码,我使用setup方法来初始化我的UIView,因为我无法调用

[[NSBundle mainBundle] loadNibNamed:xib owner:self options:nil] ;
Run Code Online (Sandbox Code Playgroud)

在initWithCoder里面导致无限循环.

-(id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if(self)
    {
    }
    return self;
}

-(void) setup
{
    NSString *xib= @"CustomUIView";
    NSArray *array=[[NSBundle mainBundle] loadNibNamed:xib owner:self options:nil] ;
    UIView *view =[array objectAtIndex:0];
    //code that doesn't work
    [_positionLabel setText:@"hello world"];
    //
    [self addSubview:view];
}
Run Code Online (Sandbox Code Playgroud)

这是我的根视图控制器.h

- (void)viewDidLoad
{
    [super viewDidLoad];
    [_moduleCustomView setup];
    [self.view addSubview:_moduleCustomView];
    //code doesn't work 
    [_moduleCustomView setText:@"hello world"];
}
Run Code Online (Sandbox Code Playgroud)

即使在做了加载我也无法改变文字

use*_*013 5

我发现了我的错误,它是关于文件所有者,我在检查器中更改了它但是通过选择uiview而不是te文件的所有者,我将NSObject更改为我的类名并重新连接标签.