已由 UIAlertController 代替
已由 UIAlertController 代替
已由 UIAlertController 代替
//////别忘在 .h 中写代理 <UIAlertViewDelegate>
////通常放在button的点击效果里
- (void)buttonClick{
UIAlertView* alv = [[UIAlertView alloc] initWithTitle:@"标题" message:@"你喜欢我吗?" delegate:self cancelButtonTitle:@"不喜欢" otherButtonTitles:@"很喜欢",@"超级喜欢", nil];
[alv show];
//[alv release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
//不喜欢0 很喜欢1 超级喜欢2.......
if (buttonIndex == 0) {
[self buttonClick];
}
}
//代码控制 消失
[Alert dismissWithClickedButtonIndex:0 animated:NO];
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex