viewDidLoad上的查看出口是零

时间:2016-04-20 22:01:21

标签: ios objective-c interface-builder xib

我的文件所有者有3个出口,所有这些出口在viewDidLoad上都是零...

__weak IBOutlet UIView *mainImagePlaceholderView;
__weak IBOutlet UILabel *mainImageLabel;
__weak IBOutlet UIView *imageFilmstripPlaceholderView;

这些位于我的.m文件中,...

@implementation iRpImageViewerViewController
{
    ...
    __weak IBOutlet UIView *mainImagePlaceholderView;
    __weak IBOutlet UILabel *mainImageLabel;
    __weak IBOutlet UIView *imageFilmstripPlaceholderView;
    ...
}
  • 我的课程是iRpImageViewerViewController.xib
  • 在IB中,'文件所有者自定义类'是' iRpImageViewerViewController.m'
  • 在IB中,笔尖查看自定义类'是UIView

所有内容都显示为正确连接。 我已经清理了我的构建文件夹。 我已经清除了我的派生数据文件夹。 我甚至试图通过在init方法中引用它们并设置它们的背景来欺骗视图加载。

-(void)viewDidLoad
    {
        [super viewDidLoad];

        // Do any additional setup after loading the view from its nib.

        theMainImageGridviewControl = [[IGGridView alloc]initWithFrame:mainImagePlaceholderView.frame style:IGGridViewStyleSingleCellPaging];

        // Set additional properties to configure the grid view
        theMainImageGridviewControl.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        theMainImageGridviewControl.selectionType = IGGridViewSelectionTypeCell;
        theMainImageGridviewControl.contentInset = UIEdgeInsetsZero;
        theMainImageGridviewControl.allowHorizontalBounce = NO;
        theMainImageGridviewControl.alwaysBounceHorizontal = NO;
        theMainImageGridviewControl.alwaysBounceVertical = NO;

        [mainImagePlaceholderView addSubview:theMainImageGridviewControl];

        // Setting a breakpoint here reveals that all the outlets are nil
        [self addAChildViewController:theFilmstripViewController toViewWithTag:imageFilmstripPlaceholderView.tag];

        [self constructAndConfigurePrimaryImageMarker];

    }

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

不确定您是如何创建XIB和视图控制器的,但是您是否尝试将以下内容添加到为视图控制器调用的初始化程序中:

self = [super initWithNibName:@"iRpImageViewerViewController" bundle:nil];