2011-09-27 56 views
1

我遇到了一個非常漂亮的API MBProgressHUD,但是當我在閱讀文檔中的標頭MBProgressHUD.h我糊塗了,因爲醫生說是- (id)initWithWindow:(UIWindow *)window;便捷構造MBProgressHUD命名約定澄清

根據有關memory management蘋果文檔,方便構造函數不應該與任何以下的前綴:初始化ALLOC複製

任何人都可以澄清我是否在這裏失去了一些東西?

/*** 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; 
+0

你應該添加一個錯誤報告。 :)現在修復。 https://github.com/jdg/MBProgressHUD/commit/4ba6e7f524577c84e15edfaf035382e994c3bfe7 –

+0

woops,我會做下一次:)感謝修復! – mrd3650

回答

1

我相信問題是與評論。便利的構造函數返回自動釋放的對象,但是這個- (id)initWithWindow:(UIWindow *)window;沒有。因此,構造函數的名字是好的,但評論應該更新。

編輯: 我總是發現MBProgressHUD有點複雜,直到我遇到github上的this nice replacement

+0

感謝@ mja的澄清和替代progressHUD鏈接。我看了一下,看起來很簡單。不過,我想指出,MBProgressHUD有一個非常好的功能;只需一行,您可以在運行@selector()時顯示HUD,並在完成時停止。 – mrd3650