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);
浙公網安備 33010602011771號