MBProgressHUD命名约定澄清

时间:2011-09-27 11:20:21

标签: ios memory-management mbprogresshud

我遇到了一个非常好的API MBProgressHUD,但是当我在标题MBProgressHUD.h中阅读文档时,我感到很困惑,因为文档说- (id)initWithWindow:(UIWindow *)window;的便利构造即可。

根据有关memory management的Apple文档,便捷构造函数不应以下列任何一个为前缀: init alloc copy

有人可以澄清我在这里是否遗漏了什么?

/*** A convenience constructor that initializes the HUD with the window's bounds.  
* Calls the designated constructor with  
* window.bounds as the parameter.  
* @param window The window instance that will provide the bounds for the HUD.  
* Should probably be the same instance as  
* the HUD's superview (i.e., the window that the HUD will be added to).  
*/  
- (id)initWithWindow:(UIWindow *)window;

1 个答案:

答案 0 :(得分:1)

我认为问题在于评论。便捷构造函数返回自动释放的对象,但- (id)initWithWindow:(UIWindow *)window;没有。因此,构造函数的名称很好,但应该更新注释。

编辑: 我总是发现MBProgressHUD有点复杂到我的口味,直到我在github上遇到this nice replacement