设置了UIAlertView的Delegate属性后,当按钮被触控时,将调用次delegate的alerView:clickedButtonAtIndex:方法。uialertViewDelegate协议中还定义了现实和关闭警告框通知状态变化。
方法名
-(void)willpresentAlertView:(UIalertView*)alertView
调用时机
警告框显示前被调用
方法名
-(void)didpresentAlertView:(UialertView*)alertView
调用时机
警告框显示后被调用
方法名
-(void)alertViewCancel:(UIAlertView *)alertView
调用时机
警告显示中强制关闭是被调用。例如:警告框显示时程序突然关闭等场合。注意:触摸按钮时不调用该方法。
方法名
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
调用时机
触摸警告框中的任意按钮时被调用。此方法比-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex方法先辈调用。
方法名
-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
调用时机
警告框关闭前调用
方法名
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
调用方法
警告框关闭前被调用。警告框显示中应用程序进入睡眠状态时被调用。