在CCLayer中uiActionSheet init失败
问题描述:
环境:ios; iPad的; cocos2d的在CCLayer中uiActionSheet init失败
我在这我想弹出一个UIActionSheet来验证用户一个“退出游戏”的请求是Cocos2d CCLayer派生类。带来的UIActionSheet起来的代码如下:
UIActionSheet *verifyQuit = [[UIActionSheet alloc] initWithTitle:@"Quit Game ?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"OK"
otherButtonTitle:nil];
[verifyQuit showInView:[UIApplication sharedApplication].keyWindow];
[verifyQuit release];
上的init(我的样品中的第一行),我得记录到调试器控制台错误:
- [UIActionSheet initWithTitle:委托:cancelButtonTitle:destructiveButtonTitle:otherButtonTitle:]:无法识别的选择器发送到实例0x54cb10
init永远不会返回,并且重复记录该错误,直到我从调试器中停止该程序。我不知道地址是0x54cb10的对象是什么 - 它不是我尝试实例化UIActionSheet的CCLayer派生的对象。
关于我在这里遇到什么的任何想法?
谢谢!
答
这只是你错过的一件小事。
otherButtonTitle:nil
应该
otherButtonTitles:nil
有一个小号在参数名的末尾失踪 - 因此编译器不能找到方法。
啊,现在我觉得很蠢。谢啦。我翻遍了它;我想我有隧道视野。 –