嗨,大家好!
我正在尝试使用CCMenu类。我有这个方法:
-(void)showMenuItems {
CGSize size = [[CCDirector sharedDirector] winSize];
[CCMenuItemFont setFontSize:28];
CCMenuItem *runAlertItem = [CCMenuItemFont itemWithString:@"Show Alert" target:self selector:@selector(showAlert)];
CCMenuItem *showTwitterPageItem = [CCMenuItemFont itemWithString:@"Twitter" target:self selector:@selector(showWebView)];
CCMenuItem *showApplePageItem = [CCMenuItemFont itemWithString:@"Apple" block:^(id sender) {
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 480.0, 320.0)];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http:/www.apple.com"]]];
[[[CCDirector sharedDirector] view] addSubview:webView];
[self scheduleOnce:@selector(hideWebView) delay:10];
}];
mainMenu = [CCMenu menuWithItems:runAlertItem, showTwitterPageItem, showApplePageItem, nil];
[mainMenu alignItemsVerticallyWithPadding:10];
mainMenu.position = CGPointMake(size.width / 2, size.height / 2);
[self addChild:mainMenu];
}
现在,我想这样调用这个方法:
[self scheduleOnce:@selector(showMenuItems) delay:71];
不幸的是,菜单没有出现。
我做错了什么?
提前致谢!