Ios UIAlertview赢得';t测井结果
如果用户在我的Ios UIAlertview赢得';t测井结果,ios,objective-c,uialertview,uialertviewdelegate,Ios,Objective C,Uialertview,Uialertviewdelegate,如果用户在我的alertView上按了OK,我想记录,但它什么也没做。。。这是我的支票: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { NSLog(@"user pressed OK"); } } 它也在我的@界面中: @interface FirstViewController : UIViewContro
alertView
上按了OK,我想记录,但它什么也没做。。。这是我的支票:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) { NSLog(@"user pressed OK"); }
}
它也在我的@界面中
:
@interface FirstViewController : UIViewController<UIWebViewDelegate, UIAlertViewDelegate>
有人看到问题了吗?我尝试在if按钮索引
之外执行NSLog
,但也不会被记录
谢谢将您的代表指定为self而不是nil,使用以下命令将您的代表指定为self而不是nil:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oeps..."
message:@"This is just a random message."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
使用以下命令:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oeps..."
message:@"This is just a random message."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
检查您的委托您将委托传递给了nil。把它传给self,这就是发生的事情 像这样
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oeps..."
message:@"This is just a random message."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
检查您的委托您将委托传递给了nil。把它传给self,这就是发生的事情 像这样
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oeps..."
message:@"This is just a random message."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];