#UIAlertController.h
UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
UIAlertView 在ios9.0版本被UIAlertController取代了
//
// UIAlertController.h
// UIKit
//
// Copyright (c) 2014-2015 Apple Inc. All rights reserved.
//
#import <UIKit/UIViewController.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, UIAlertActionStyle) { // 按鈕的樣式
UIAlertActionStyleDefault = 0, //確定按鈕
UIAlertActionStyleCancel, // 取消按鈕
UIAlertActionStyleDestructive // Destructive 破壞性的慢睡,毀滅性的逐工,銷(xiāo)毀或刪除按鈕
} NS_ENUM_AVAILABLE_IOS(8_0);
typedef NS_ENUM(NSInteger, UIAlertControllerStyle) { // 彈窗的樣式
UIAlertControllerStyleActionSheet = 0, // 從底部彈出
UIAlertControllerStyleAlert // 從中間彈出
} NS_ENUM_AVAILABLE_IOS(8_0);
NS_CLASS_AVAILABLE_IOS(8_0) @interface UIAlertAction : NSObject <NSCopying> // 按鈕的接口
+ (instancetype)actionWithTitle:(nullable NSString *)title style:(UIAlertActionStyle)style handler:(void (^ __nullable)(UIAlertAction *action))handler; // 按鈕的初始化類(lèi)方法 title 按鈕的標(biāo)題, style 按鈕的樣式 漂辐, handler 按鈕點(diǎn)擊后執(zhí)行的回調(diào)
@property (nullable, nonatomic, readonly) NSString *title; // 按鈕的標(biāo)題
@property (nonatomic, readonly) UIAlertActionStyle style; // 按鈕的樣式
@property (nonatomic, getter=isEnabled) BOOL enabled; // 按鈕是否可以點(diǎn)擊
@end
NS_CLASS_AVAILABLE_IOS(8_0) @interface UIAlertController : UIViewController // 彈窗控制器的接口
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(UIAlertControllerStyle)preferredStyle; // 彈窗的初始化類(lèi)方法
title 彈窗的標(biāo)題泪喊, message 彈窗標(biāo)題下面的信息, preferredStyle 彈窗的樣式
- (void)addAction:(UIAlertAction *)action; // 彈窗添加按鈕的對(duì)象方法
@property (nonatomic, readonly) NSArray<UIAlertAction *> *actions; //裝有彈窗里添加的按鈕的數(shù)組
@property (nonatomic, strong, nullable) UIAlertAction *preferredAction NS_AVAILABLE_IOS(9_0); // 彈窗里的按鈕
- (void)addTextFieldWithConfigurationHandler:(void (^ __nullable)(UITextField *textField))configurationHandler; // 往彈窗添加文本框的對(duì)象方法髓涯, 頭文件描述寫(xiě)到后面的回調(diào)傳進(jìn)去textField進(jìn)去袒啼,所以可以在后面的回調(diào)設(shè)置textField的屬性。
@property (nullable, nonatomic, readonly) NSArray<UITextField *> *textFields; // 裝有往彈窗添加的文本框的數(shù)組
@property (nullable, nonatomic, copy) NSString *title; // 彈窗的標(biāo)題
@property (nullable, nonatomic, copy) NSString *message; // 如上彈窗標(biāo)題下面的信息
@property (nonatomic, readonly) UIAlertControllerStyle preferredStyle; // 彈窗的樣式
@end
NS_ASSUME_NONNULL_END