重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
服從UIAlertViewDelegate 協議
Title : 標題
message : 提示消息
delegate : 代理
cancelButtonTitle : 取消顯示
otherButtonTitles : 其他按鈕顯示文字,只給出按鈕顯示的文字即可,可多個
UIAlertView * alertView = [[UIAlertView alloc]initWithTitle:@"警告"
message:@"手機號碼輸入錯誤"
delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"確定",@"sure", nil];
UIAlertViewStyleDefault = 0, 默認
UIAlertViewStyleSecureTextInput, 密碼
UIAlertViewStylePlainTextInput, 輸入框
UIAlertViewStyleLoginAndPasswordInput 登錄,密碼
alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
[alertView show]; 讓alertView 彈出
[alertView release];
當點擊 alertView 上 button時 觸發的方法.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
取消按鈕的buttonindex 為 0
其他的按鈕從左往右依次 + 1 ;
通過switch..case 匹配是哪一個按鈕按下
switch (buttonIndex) {
case 0:
NSLog(@"取消");
break;
case 1:
NSLog(@"確定");
break;
case 2:
NSLog(@"sure");
break;
default:
break;
}
}
當我們取消一個視圖(如。用戶單擊按鈕)。這不是用戶單擊取消按鈕時調用。
如果沒有定義的委托,我們模擬點擊取消按鈕
- (void)alertViewCancel:(UIAlertView *)alertView;
- (void)willPresentAlertView:(UIAlertView *)alertView;
動畫和之前顯示視圖
- (void)didPresentAlertView:(UIAlertView *)alertView;
動畫后
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex;
之前動畫和隱藏視圖
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
動畫后
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView;
編輯的任何違約后稱為字段添加的風格
另外有需要云服務器可以了解下創新互聯scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。