UIAlertView使用

UIAlertViewDelegate定义的常用方法

 1 // Called when a button is clicked. The view will be automatically dismissed after this call returns
 2 //当用户单击警告框中得某个按钮时激发该方法,buttonIndex代表用户单击的按钮的索引,从0开始
 3 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
 4 
 5 // Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button.
 6 // If not defined in the delegate, we simulate a click in the cancel button
 7 //取消按钮时(用户单击home键)激发
 8 - (void)alertViewCancel:(UIAlertView *)alertView;
 9 
10 // before animation and showing view
11 //警告框将要显示出来时激发
12 - (void)willPresentAlertView:(UIAlertView *)alertView;  
13 
14  // after animation
15 //警告框完全显示出来后激发
16 - (void)didPresentAlertView:(UIAlertView *)alertView; 
17 
18 // before animation and hiding view
19 //当用户通过单击某个按钮将要隐藏该警告框时激发
20 - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex; 
21 
22 // after animation
23 //当用户通过单击某个按钮完全隐藏该警告框时激发
24 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;  
25 
26 // Called after edits in any of the default fields added by the style
27 //每次编辑输入框时会调用
28 - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView;

UIAlertView的actionSheetStyle属性

1    UIAlertViewStyleDefault = 0,//默认的警告框风格
2     UIAlertViewStyleSecureTextInput,//警告框中包含一个密码输入框
3     UIAlertViewStylePlainTextInput,//警告框中包含一个普通输入框
4     UIAlertViewStyleLoginAndPasswordInput//警告框中包含用户名、密码两个输入框

访问警告框中textField 索引从0开始,自IOS5.0以后有的方法

- (UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0);

 

posted @ 2015-08-09 19:16  qinpei  阅读(199)  评论(0编辑  收藏  举报