未调用appdelegate中的clickedButtonAtIndex [英] clickedButtonAtIndex in appdelegate is not called
本文介绍了未调用appdelegate中的clickedButtonAtIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MyapplicationAppDelegate.m文件中用2个按钮取消和确定调用UIAlert,调用警报,但点击取消或确定按钮
I am calling UIAlert with 2 buttons "Cancel" and "OK" in MyapplicationAppDelegate.m file , the alert is called but on tap of "Cancel" or "OK" button
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
$ b不调用
$ b
方法。
method is not called.
我在MyapplicationAppDelegate.h文件中添加了UIAlertViewDelegate,如下所示
I have added UIAlertViewDelegate in the MyapplicationAppDelegate.h file as below
#import UIKit/UIKit.h
@interface MyapplicationAppDelegate: NSObject UIApplicationDelegate,UIAlertViewDelegate
{
..
}
我想知道还需要什么。
推荐答案
我我不确定在发布问题时你的拼写错误,但你应该在< ..,..>
I am not sure whether its your typo while posting the question but you should call the delegate within <.. , .. >
@interface MyapplicationAppDelegate: NSObject <UIApplicationDelegate,UIAlertViewDelegate> { .. }
以下是UIAlertView的示例代码
Here is sample code for UIAlertView
UIAlertView *myAlertView = [[UIAlertView alloc]initWithTitle:@""message:@"Your message goes here" delegate:self cancelButtonTitle:@"OK"otherButtonTitles:nil];
[myAlertView show];
[myAlertView release];
我不确定myAlertView.delgate = self是正确的方法,但我确实设置了委托使用initWithTitle
这篇关于未调用appdelegate中的clickedButtonAtIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文