当用户点击按钮时UIAlertView
the clickedButtonAtIndex
应该调用方法,但是,它没有:
in the .h
我已经打电话给UIAlertView
协议 :
@interface RechercherViewController : UIViewController<UIAlertViewDelegate> {
//code
}
and in .m
文件我有这个:
-(void)requestFailed:(ASIHTTPRequest *)request
{
//quand il y aura un échec lors de l'envoie de la requête
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"TopStation"
message :@"Your internet connexion is down"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
NSLog(@"buttonIndex 0");
} else if(buttonIndex == 1) {
NSLog(@"buttonIndex 1");
}
}
日志文件中没有显示任何内容,请帮忙,提前谢谢:)
delegate:nil
是问题所在。经过self
作为代表initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)