彈框

//

// ?ViewController.m

//彈框

//

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

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

//

//UITextField:怎么獲取UITextField的文本,怎么設(shè)置輸入框鍵盤類型,設(shè)置占位字符串,密文輸入

#import"ViewController.h"

@interfaceViewController()

@end

@implementationViewController

- (void)viewDidLoad {

[superviewDidLoad];

}

- (IBAction)alertAction:(id)sender {

//彈框:UIAlertController

//Title:大標(biāo)題

//message:小標(biāo)題

//preferredStyle:彈框樣式

UIAlertController*alertController = [UIAlertControlleralertControllerWithTitle:@"你有病"message:@"你可以去吃藥了"preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction*okAction = [UIAlertActionactionWithTitle:@"確定"style:UIAlertActionStyleDestructivehandler:^(UIAlertAction*_Nonnullaction) {

//按鈕按下要做的事情

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

}];

//取消

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

//給彈框添加行為

[alertControlleraddAction:okAction];

[alertControlleraddAction:cancelAction];

[selfpresentViewController:alertControlleranimated:YEScompletion:nil];

}

- (void)didReceiveMemoryWarning {

[superdidReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • 自從iOS9出來之后,需要使用UIAlertController來彈出彈框,不在提倡使用UIAlertView了,...
    南京楊小兵閱讀 573評論 1 0
  • 第一個類 UIAlertView:繼承于UIView,類的對象為彈框。彈框在屏幕中央 彈提示控件的方法(彈框):提...
    第1001號群眾演員閱讀 1,293評論 0 0
  • // // ViewController.m // 彈框 // // Created by lanou on 16...
    墨染傾閱讀 292評論 0 0
  • // // ViewController.m //彈框 // // Created by lanou on 16/...
    高光燉湯閱讀 309評論 0 0
  • 雨落池塘染紅蓮,獨步硯亭淚屋檐。 默看魚鯉嬉戲水,悄笑郎情拂吹煙。 翊楓汝裔
    翊楓汝裔閱讀 161評論 0 0