W D*_*son 0 iphone uialertview uiapplicationdelegate ios4
我正在使用UIAlertViewDelegate在我的应用程序启动时使用UIAlertView.一切正常.唯一的问题是,每当我引用App Delegate时,我都会收到警告"type'id'不符合'UIAlertViewDelegate'协议",给出了大约32个警告.
谁能解释为什么我会收到这个警告以及我如何满足它?
提前致谢!
我假设你的app delegate是你的警报视图委托?
如果是这样,您需要告诉编译器在app委托的声明中.像这样:
@interface SomeAppDelegate : NSObject <UIApplicationDelegate, UIAlertViewDelegate> {
}
// ... rest of interface
@end
Run Code Online (Sandbox Code Playgroud)
然后您还需要实现所需的方法.
编辑:进一步思考,我想你可能会在引用应用代表时错过演员.所以你有这样的事情:
MyAppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
// what you want is:
MyAppDelegate* appDelegate = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2627 次 |
| 最近记录: |