0

这是MBProgressHUD的简单使用代码

// Add at the top of the file
#import "MBProgressHUD.h"

// Add right before return TRUE in textFieldShouldReturn
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.labelText = @"Redeeming code...";

// Add at start of requestFinished AND requestFailed
[MBProgressHUD hideHUDForView:self.view animated:YES];

显然我们需要一个视图来添加 MBProgressHUD。

问题是cocos2d中没有view,只有CCNode。

那么,有没有办法解决这个问题呢?

通过将 UIview 添加到 CCLayer 上?

如果这是一个愚蠢的问题,请接受我的道歉,因为我还是编程新手。

4

1 回答 1

0

无法将 UIView 添加到 CCLayer 上,因为它们是单独的视图层次结构'

您将需要找到您的顶级 EAGLView(它是 UIView 的子类)并将 MBProgressHUD 添加为其子级。或者使用 cocos2d 菜单系统。

或者您可以将 MBProgressHUD 代码移植到 cocos2d 中?

于 2012-04-02T03:49:57.460 回答