When you create an instance of your class, the _frame
instance variable is automatically initialized, even before the init
method is called. Since _frame
is a C-struct (CGRect
), its memory is cleared to all zeroes. This results in a CGRect
with all zero values.
CGRectNull
is a special, non-zero CGRect
. So your check using CGRectIsNull()
will never be true.
Using CGRectIsEmpty
is a more proper check for this.