gpt4 book ai didi

ios - viewDidLoad 上的 View 导出为零

转载 作者:行者123 更新时间:2023-12-01 20:15:42 24 4
gpt4 key购买 nike

我的文件所有者有 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;
...
}
  • 我的类(class)是 iRpImageViewerViewController.xib
  • 在 IB 中,“文件所有者自定义类”是“iRpImageViewerViewController.m”
  • 在 IB 中,nib 'view custom class' 是 UIView

  • 一切都显示为正确连接。
    我已经清理了我的构建文件夹。
    我已经清除了我的派生数据文件夹。
    我什至试图通过在 init 方法中引用它们并设置它们的背景色来欺骗 View 加载。
    -(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

    最佳答案

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

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

    关于ios - viewDidLoad 上的 View 导出为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36756020/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com