我可以依靠nil UIView返回CGRectZero作为其框架吗? [英] Can I rely on nil UIView returning CGRectZero for its frame?

查看:208
本文介绍了我可以依靠nil UIView返回CGRectZero作为其框架吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我看到了这个:


如果该方法返回一个结构,由Mac OS X ABI函数调用指南定义在寄存器中返回,然后发送到nil的消息为结构中的每个字段返回0.0。其他结构数据类型不会用零填充。

If the method returns a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, then a message sent to nil returns 0.0 for every field in the struct. Other struct data types will not be filled with zeros.

我只是不明白。

推荐答案

如果您使用的是最新版本的LLVM编译器(Xcode 4.2或更高版本),那么是,发送消息 nil 使用struct-returning方法将生成一个零填充结构。在 CGRect 的情况下,这意味着一个矩形等于 CGRectZero

If you're using recent versions of the LLVM Compiler (Xcode 4.2 or later), then yes, messaging nil with a struct-returning method will produce a zero-filled struct. In the case of CGRect, that means a rect equal to CGRectZero.

来源: Greg Parker ,谁在ObjC运行时在Apple工作。

Source: Greg Parker, who works at Apple on the ObjC runtime.

这篇关于我可以依靠nil UIView返回CGRectZero作为其框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆