1

非常に優れたAPIMBProgressHUDに出くわしましたが、ヘッダーMBProgressHUD.hのドキュメントを読んでいたときに、ドキュメントに便利なコンストラクター- (id)initWithWindow:(UIWindow *)window;であると書かれているため、混乱しました。

メモリ管理に関するAppleのドキュメントによると、コンビニエンスコンストラクターの前にinitalloccopyのいずれも付けないでください。

誰かが私がここで何かを逃しているかどうかを明確にすることができますか?

/*** 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;
4

1 に答える 1

1

問題はコメントにあると思います。コンビニエンスコンストラクターは自動解放されたオブジェクトを返しますが、これは返し- (id)initWithWindow:(UIWindow *)window;ません。したがって、コンストラクターの名前は問題ありませんが、コメントを更新する必要があります。

編集:githubでこの素晴らしい代替品に出くわすまで、MBProgressHUDは私の好みに少し複雑であることにいつも気づきました。

于 2011-09-27T11:28:38.480 に答える