彈框之一:提示框
1.創(chuàng)建提示框?qū)ο?,即UIAlertController對象
01. ...
02. UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"標(biāo)題" message:@"alert提示框的內(nèi)容" preferredStyle:UIAlertControllerStyleAlert];
03. // 類方法:alertControllerWithTitle: message: preferredStyle:
04. // @Parameter
05. // P1:提示框的標(biāo)題,一般設(shè)置為nil
06. // P2:提示框的提示文本
07. // P3:提示框的顯示類型,一般選擇UIAlertControllerStyleAlert,這種類型可以理解成iOS9.0之前的UIAlertView控件類型
08. ...
2.創(chuàng)建提示框的按鈕對象,即UIAlertAction對象
01. ...
02. UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"標(biāo)題" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action){按鈕點(diǎn)擊事件的處理}];
03. // 類方法:actionWithTitle: style: handler:
04. // @Parameter
05. // P1:按鈕顯示的文本
06. // P2:按鈕類型
07. // P3:按鈕點(diǎn)擊事件
08 ...
3.將創(chuàng)建的按鈕添加到提示框上
01. ...
02. [alert addAction:alertAction];
03. // 對象方法:addAction
04. // @Parameter
05. // P1:按鈕對象
06. ...
4.提示框是以控制器試圖的形式創(chuàng)建的,直接呈現(xiàn)在根控制器試圖上即可
01. ...
02. [self presentControllerView:alert animated:YES completion:nil]
03. // 對象方法:presentControllerView: animated: completion:
04. // @Parameter
05. // P1:要呈現(xiàn)的控制器試圖對象
06. // P2:動(dòng)畫效果,邏輯值
07. // P3:完成呈現(xiàn)后的執(zhí)行事件,一般為nil
08. ...
5.這樣就成功顯示了一個(gè)提示框

提示框的基礎(chǔ)樣式
提示框的樣式還有很多可以設(shè)置的點(diǎn),比如添加一個(gè)密碼框等等,詳情見iOS9.0之后提示框進(jìn)階樣式
彈框之二:上拉菜單
1.基本操作同上提示框的創(chuàng)建,只需要更改控制器試圖的類型即可。
01. ...
02. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"提示內(nèi)容" preferredStyle:UIAlertControllerSytleActionSheet];
03. // preferredSytle:
04. // Style1:UIAlertControllerStyleAlert -- 提示框
05. // Style2:UIAlertControllerStyleActionSheet -- 按鈕的上拉菜單
06. ...
2.接下來的操作參照提示框的步驟,只是需要注意上拉菜單是無法添加文本框的。

上拉菜單的基礎(chǔ)樣式