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

首頁 > 系統(tǒng) > iOS > 正文

IOS之彈框的實現(xiàn)方法

2020-02-19 15:46:33
字體:
供稿:網(wǎng)友

我們在開發(fā)項目的時候,都需要要彈框的提示,但是彈框的實現(xiàn)方式要在IOS中如何實現(xiàn)呢?別著急,今天就跟著武林技術(shù)頻道小編的步伐來了解IOS之彈框的實現(xiàn)方法。

IOS 中彈框的實現(xiàn)方法整理

#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];

以上就是武林技術(shù)頻道小編對IOS之彈框的實現(xiàn)方法,其實我們可以根據(jù)自己的實際情況進行實際操作,武林技術(shù)頻道還有更多的專業(yè)知識哦。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 永定县| 龙泉市| 阳原县| 辽宁省| 黄山市| 深州市| 突泉县| 信宜市| 富源县| 香港 | 大连市| 寿阳县| 石狮市| 邯郸县| 四会市| 枣庄市| 永嘉县| 临沂市| 双城市| 花莲市| 双桥区| 金华市| 伽师县| 鹿泉市| 巨野县| 曲靖市| 会宁县| 稻城县| 长子县| 水城县| 革吉县| 察雅县| 共和县| 翁牛特旗| 全椒县| 安西县| 新邵县| 通渭县| 桦川县| 松滋市| 元谋县|