日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

IOS--UIAlertView的使用方法详细

發布時間:2023/12/20 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 IOS--UIAlertView的使用方法详细 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

IOS--UIAlertView的使用方法詳細

?

????// UIAlertView的常用方法

????//?標準樣式

????UIAlertView?*oneAlertView = [[UIAlertView?alloc]?initWithTitle:@"標題"message:@"提示內容"?delegate:self?cancelButtonTitle:@"關閉"otherButtonTitles:@"OK",?nil];

????[oneAlertView?show];?//?顯示出來

????[oneAlertView?release], oneAlertView =?nil;?//?釋放內存

?

????oneAlertView.alertViewStyle?=?UIAlertViewStyleDefault;?//?設置oneAlerView的樣式

//????UIAlertViewStyleDefault?只彈信息和按鈕

//????UIAlertViewStyleSecureTextInput?有一個textfield加密框

//????UIAlertViewStylePlainTextInput?有一個不加密的textfield

//????UIAlertViewStyleLoginAndPasswordInput?有兩個textfield,Login和password

?

?

?

//?按鈕橫排顯示

????UIAlertView?*twoAlertView = [[UIAlertView?alloc]?initWithTitle:@"標題"message:@"提示內容"?delegate:self?cancelButtonTitle:@"關閉"?otherButtonTitles:@"按鈕1",?@"按鈕2",?@"按鈕2",?nil];

????[twoAlertView?show]; //?顯示出來

????[twoAlertView?release], twoAlertView =?nil; //?釋放內存

// 添加了多個按鈕,那么要怎么判斷我們按下的是哪個按鈕呢?

// 需要在.h文件中實現UIAlertViewDelegate代理,然后在.m文件中重寫下面的方法

?

#pragma mark -?實現UIAlertView的代理方法判斷按了哪個按鈕

- (void)alertView:(UIAlertView?*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

????//?獲取您按下的是哪個按鈕

????NSString* msg = [[NSString?alloc]?initWithFormat:@"您按下的第%d個按鈕!",buttonIndex];

????NSLog(@"%@", msg);

????[msg?release], msg =?nil;

????//?點擊“取消”,“按鈕1”,“按鈕2”,“按鈕3”的索引buttonIndex分別是0,1,2,3

}

?

?

?

?

????//?給UIAlertView添加其他

????UIAlertView*alert = [[UIAlertView?alloc]initWithTitle:@"請等待"

??????????????????????????????????????????????????message:nil

?????????????????????????????????????????????????delegate:nil

????????????????????????????????????????cancelButtonTitle:nil

????????????????????????????????????????otherButtonTitles:nil];

????[alert?show];

????UIActivityIndicatorView?*activeView = [[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

????activeView.center?=?CGPointMake(alert.bounds.size.width/2.0f, alert.bounds.size.height-40.0f);

????[activeView?startAnimating];

????[alert?addSubview:activeView];

????[activeView?release];

????[alert?release];



?

// 還有很多方法,想深入了解的可以查看api自己慢慢試試。這些基本夠用了。。。

?

轉載于:https://www.cnblogs.com/iOS-mt/p/4147804.html

總結

以上是生活随笔為你收集整理的IOS--UIAlertView的使用方法详细的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。