彈框

//

// ?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)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

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

友情鏈接更多精彩內(nèi)容