Tag: 结构的

Objective-C结构体的默认值以及如何testing

我试图testing一个属性是否已经设置。 我知道用我得到的物体: CGRect ppGoalFrame; LocalPlaySetup *localPlaySetup; 我可以testing if (localPlaySetup == nil) 但如果我试图用== nil或== NULL来testingCGRect if (ppGoalFrame == nil) 我明白了 invalid operands to binary == (have 'CGRect' and 'void *') 那么CGRect是否为“void”,null,nil …? 在它被设置之前? 显然,我不能比较CGrect到一个无效指针(我不能使用ppGoalFrame == void ); 还有另一种方法来testing这个? Objective-C到目前为止是相当容易理解,但只要C织机,我有点失落。