“Variable Undeclared” error when compiling to iOS Device, but not for Simulator

后端 未结 10 1334
时光取名叫无心
时光取名叫无心 2020-12-31 10:15

I have an custom UIVIewController that is the base class for other controllers and has an instance of a custom UIView variable that is accessed by inherited the classes.

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-31 10:57

    The error says that _vwHeader undeclared. So try by modifying the code in:

    CustomViewController.m

        #import "CustomViewController.h"
        @implementation CustomViewController
    
        - (void)loadView
        {
            [super loadView];
            if(!_vwHeader)
            {
               _vwHeader = [[UIView alloc]init];
            }
            [_vwHeader setHidden:NO];
        }
    
        @end
    

提交回复
热议问题