开发者

Check if NSRect is null

开发者 https://www.devze.com 2023-03-14 23:17 出处:网络
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.

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)).

0

精彩评论

暂无评论...
验证码 换一张
取 消