Check if NSRect is null
I'm not able to check if a NSRect structure has a value.
if(!myRect)// produce an error
if(myRect== nil) //this's not a 开发者_运维问答pointer...can't works.
Which is the correct way ?
I think the NSIsEmptyRect
function is more comfortable, right?
If you just want to check with the zero rect.
An NSRect
is a struct, not a pointer, and therefor it can't be nil
or NULL
. You can however check if a rect is equal to NSZeroRect
with if(NSEqualRects(myRect, NSZeroRect))
.
精彩评论