彈框

//

// ?ViewController.m


// ?彈框

//


// ?Created by lanou on 16/7/13.

// ?Copyright ? 2016年 lanou. All rights reserved.


//

//UITextfeild:怎么獲取UITextFielld的文本,怎么設置輸入框鍵盤類型,設置占位字符串


#import "ViewController.h"



@interface ViewController ()



@end



@implementation ViewController



- (void)viewDidLoad {

? ? [super viewDidLoad];


? ? // Do any additional setup after loading the view, typically from a nib.

}


- (IBAction)alertAction:(id)sender {

// ? ?彈框:UIAlertConteoller


// ? ?Title:大標題

// ? ?message:小標題


// ? ?preferredStyle:彈框樣式

? ? UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"你好么" message:@"我很好啊" preferredStyle:UIAlertControllerStyleAlert];


? ? UIAlertAction *okAction=[UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

// ? ? ? ?按鈕按下要做的事情


? ? ? ? NSLog(@"淮南師范學院");

? ? }];


? ? UIAlertAction *cancelAction=[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:nil];



// ? ?給彈框添加行為

? ? [alertController addAction:okAction];


? ? [alertController addAction:cancelAction];

? ? [self presentViewController:alertController animated:YES completion:nil];


}






- (void)didReceiveMemoryWarning {

? ? [super didReceiveMemoryWarning];


? ? // Dispose of any resources that can be recreated.

}



?@end

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • // // ViewController.m // 彈框 // // Created by lanou on 16...
    墨染傾閱讀 312評論 0 0
  • 自從iOS9出來之后,需要使用UIAlertController來彈出彈框,不在提倡使用UIAlertView了,...
    南京楊小兵閱讀 627評論 1 0
  • 1.中間彈出效果: UIAlertController *alert = [UIAlertController a...
    獨角獸ios閱讀 1,705評論 0 1
  • iOS 10.2 之前,為了交互良好,在調用撥打電話之前會自己設置彈框;在IOS10.2之后系統(tǒng)做了改版,對App...
    oneDemo閱讀 2,279評論 0 1
  • 又是一個下雨的天氣,恰好心情也不好,心情不好的時候,就覺得全世界都對你不公平。 還是俗話說的好,話糙理不糙。什么心...
    二三四234閱讀 316評論 0 0

友情鏈接更多精彩內容