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

首頁 > 系統 > iOS > 正文

IOS 中彈框的實現方法整理

2020-07-26 02:41:11
字體:
來源:轉載
供稿:網友

IOS 中彈框的實現方法整理

#define iOS8Later ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0)

ios 8以前的彈框

@interface RootViewController ()<UIAlertViewDelegate>  @end 
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"登陸失敗" message:@"請重新輸入用戶名和密碼" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];       [alert show]; 
#pragma mark - UIAlertView Delegate Methods - - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {   if(buttonIndex == 0)   {     NSLog(@"點擊取消按鈕后,想要的操作,可以加此處");   }   else if(buttonIndex == 1)   {     NSLog(@"點擊確定按鈕后,想要的操作,可以加此處");   } } 

ios8以后的彈框

      UIAlertController *_alertVC = [UIAlertController alertControllerWithTitle:@"登陸失敗" message:@"請重新輸入用戶名和密碼" preferredStyle:UIAlertControllerStyleAlert];              //警告類型,紅色字體 UIAlertActionStyleDestructive //      UIAlertAction *_doAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDestructive handler:nil]; //      [_alertVC addAction:_doAction];              UIAlertAction *_doAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action)       {         NSLog(@"點擊確定按鈕后,想要的操作,可以加此處");       }];       [_alertVC addAction:_doAction];  //      UIAlertAction *_cancleAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; //      [_alertVC addAction:_cancleAction];              UIAlertAction *_cancleAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action)       {         NSLog(@"點擊取消按鈕后,想要的操作");       }];       [_alertVC addAction:_cancleAction];              [self presentViewController:_alertVC animated:YES completion:nil]; 
//警告類型,紅色字體 UIAlertActionStyleDestructive,如下圖所示的效果      UIAlertAction *_doAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDestructive handler:nil];      [_alertVC addAction:_doAction];

如有疑問請留言或者到本站社區交流討論,希望通過本文能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 岐山县| 屏东县| 化州市| 南涧| 昭觉县| 南昌市| SHOW| 张家港市| 夏河县| 驻马店市| 新乐市| 衡南县| 乐东| 分宜县| 乌鲁木齐市| 阳新县| 比如县| 东乡族自治县| 灌云县| 唐山市| 临江市| 平湖市| 通州市| 左权县| 泾源县| 光山县| 赤城县| 南雄市| 宜兰市| 兖州市| 金山区| 乐平市| 全椒县| 谷城县| 韶关市| 四子王旗| 汤阴县| 临汾市| 巩义市| 吐鲁番市| 射洪县|