国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS UIAlertView自動關閉功能

2019-10-21 18:45:57
字體:
來源:轉載
供稿:網友

一,效果圖。

ios,uialertview,自動關閉

二,代碼。

RootViewController.h#import <UIKit/UIKit.h>@interface RootViewController : UIViewController<UIAlertViewDelegate>@endRootViewController.m- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. //alert UIAlertView *alert=[[UIAlertView alloc]initWithTitle:nil message:@"一個可以自動關閉的Alert窗口" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil]; [alert show]; //顯示框 UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; indicator.backgroundColor=[UIColor redColor]; indicator.center = CGPointMake(alert.bounds.size.width/2, alert.bounds.size.height-40.0); [indicator startAnimating]; [alert insertSubview:indicator atIndex:0]; //定時器 [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(dismissAlert:) userInfo:[NSDictionary dictionaryWithObjectsAndKeys:alert, @"alert", @"testing ", @"key" ,nil] repeats:NO];}//alert 自動消失-(void) dismissAlert:(NSTimer *)timer{ UIAlertView *alert = [[timer userInfo] objectForKey:@"alert"]; [alert dismissWithClickedButtonIndex:0 animated:YES];}

以上所述是小編給大家介紹的iOS UIAlertView自動關閉,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!


注:相關教程知識閱讀請移步到IOS開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广灵县| 台东市| 台前县| 长沙市| 宁波市| 恭城| 黎川县| 遂溪县| 恩施市| 安陆市| 昌宁县| 赣榆县| 桃园市| 石阡县| 绥宁县| 康乐县| 明水县| 将乐县| 广南县| 吴江市| 岳阳县| 潍坊市| 台湾省| 全椒县| 如东县| 龙口市| 全南县| 冷水江市| 岗巴县| 东光县| 丁青县| 无棣县| 临武县| 巴楚县| 岑溪市| 奇台县| 台北市| 马公市| 永胜县| 镇巴县| 松溪县|