Default value of an Objective-C struct and how to test

后端 未结 7 1102
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 15:33

I\'m trying to test if a property has been set yet. I know that with objects that I\'ve got:

CGRect ppGoalFrame;
LocalPlaySetup *localPlaySetup;
<
7条回答
  •  深忆病人
    2021-01-31 16:09

    From CGGeometry.h:

    /* Return true if `rect' is empty (that is, if it has zero width or height),
       false otherwise. A null rect is defined to be empty. */
    

    an empty rectangle is one that has no area, where on or both sides are zero.
    Use instead:

    CGRect newRect = CGRectNull;
    

提交回复
热议问题