FWAlertController


@interface FWAlertController : UIViewController

FWAlertController

  • Undocumented

    Declaration

    Objective-C

    + (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(FWAlertControllerStyle)preferredStyle;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(FWAlertControllerStyle)preferredStyle animationType:(FWAlertAnimationType)animationType;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(FWAlertControllerStyle)preferredStyle animationType:(FWAlertAnimationType)animationType appearance:(nullable FWAlertControllerAppearance *)appearance;
  • Undocumented

    Declaration

    Objective-C

    - (void)addAction:(FWAlertAction *)action;
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<FWAlertAction *> *actions
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong) FWAlertAction *preferredAction
  • Undocumented

    Declaration

    Objective-C

    - (void)addTextFieldWithConfigurationHandler:(void (^ __nullable)(UITextField *textField))configurationHandler;
  • Undocumented

    Declaration

    Objective-C

    @property(nullable, nonatomic, readonly) NSArray<UITextField *> *textFields
  • 主标题

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *title;
  • 副标题

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *message;
  • 弹窗样式,默认Default

    Declaration

    Objective-C

    @property (nonatomic) FWAlertStyle alertStyle;
  • 主标题(富文本)

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSAttributedString *attributedTitle;
  • 副标题(富文本)

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSAttributedString *attributedMessage;
  • 头部图标,位置处于title之上,大小取决于图片本身大小

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIImage *image;
  • 主标题颜色

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull titleColor;
  • 主标题字体,默认18,加粗

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *_Nonnull titleFont;
  • 副标题颜色

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull messageColor;
  • 副标题字体,默认16,未加粗

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *_Nonnull messageFont;
  • 对齐方式(包括主标题和副标题)

    Declaration

    Objective-C

    @property (nonatomic) NSTextAlignment textAlignment;
  • 头部图标的限制大小,默认无穷大

    Declaration

    Objective-C

    @property (nonatomic) CGSize imageLimitSize;
  • 图片的tintColor,当外部的图片使用了UIImageRenderingModeAlwaysTemplate时,该属性可起到作用

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull imageTintColor;
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic) UILayoutConstraintAxis actionAxis
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) CGFloat minDistanceToEdges
  • FWAlertControllerStyleAlert样式下默认6.0f,FWAlertControllerStyleActionSheet样式下默认13.0f,去除半径设置为0即可

    Declaration

    Objective-C

    @property (nonatomic) CGFloat cornerRadius;
  • 对话框的偏移量,y值为正向下偏移,为负向上偏移;x值为正向右偏移,为负向左偏移,该属性只对FWAlertControllerStyleAlert样式有效,键盘的frame改变会自动偏移,如果手动设置偏移只会取手动设置的

    Declaration

    Objective-C

    @property (nonatomic) CGPoint offsetForAlert;
  • 设置alert样式下的偏移量,动画为NO则跟属性offsetForAlert等效

    Declaration

    Objective-C

    - (void)setOffsetForAlert:(CGPoint)offsetForAlert animated:(BOOL)animated;
  • 是否需要对话框拥有毛玻璃,默认为YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL needDialogBlur;
  • 是否含有自定义TextField,键盘的frame改变会自动偏移,默认为NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL customTextField;
  • 是否单击背景退出对话框,默认为YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL tapBackgroundViewDismiss;
  • 单击背景dismiss完成回调,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(void) dismissCompletion;
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, weak) id<FWAlertControllerDelegate> delegate
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readonly) FWAlertControllerStyle preferredStyle
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readonly) FWAlertAnimationType animationType
  • 自定义样式,默认为样式单例

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) FWAlertControllerAppearance *_Nonnull alertAppearance;
  • 设置action与下一个action之间的间距, action仅限于非取消样式,必须在‘-addAction:'之后设置,nil时设置header与action间距

    Declaration

    Objective-C

    - (void)setCustomSpacing:(CGFloat)spacing
                 afterAction:(nullable FWAlertAction *)action;
  • Undocumented

    Declaration

    Objective-C

    - (CGFloat)customSpacingAfterAction:(nullable FWAlertAction *)action;
  • 设置蒙层的外观样式,可通过alpha调整透明度

    Declaration

    Objective-C

    - (void)setBackgroundViewAppearanceStyle:(UIBlurEffectStyle)style
                                       alpha:(CGFloat)alpha;
  • Undocumented

    Declaration

    Objective-C

    - (void)insertComponentView:(nonnull UIView *)componentView;
  • 创建控制器(自定义整个对话框)

    Declaration

    Objective-C

    + (nonnull instancetype)
        alertControllerWithCustomAlertView:(nonnull UIView *)customAlertView
                            preferredStyle:(FWAlertControllerStyle)preferredStyle
                             animationType:(FWAlertAnimationType)animationType;

    Parameters

    customAlertView

    整个对话框的自定义view

    preferredStyle

    对话框样式

    animationType

    动画类型

    Return Value

    控制器对象

  • 创建控制器(自定义对话框的头部)

    Declaration

    Objective-C

    + (nonnull instancetype)
        alertControllerWithCustomHeaderView:(nonnull UIView *)customHeaderView
                             preferredStyle:(FWAlertControllerStyle)preferredStyle
                              animationType:(FWAlertAnimationType)animationType;

    Parameters

    customHeaderView

    头部自定义view

    preferredStyle

    对话框样式

    animationType

    动画类型

    Return Value

    控制器对象

  • 创建控制器(自定义对话框的头部)

    Declaration

    Objective-C

    + (nonnull instancetype)
        alertControllerWithCustomHeaderView:(nonnull UIView *)customHeaderView
                             preferredStyle:(FWAlertControllerStyle)preferredStyle
                              animationType:(FWAlertAnimationType)animationType
                                 appearance:(nullable FWAlertControllerAppearance *)
                                                appearance;

    Parameters

    customHeaderView

    头部自定义view

    preferredStyle

    对话框样式

    animationType

    动画类型

    appearance

    自定义样式

    Return Value

    控制器对象

  • 创建控制器(自定义对话框的action部分)

    Declaration

    Objective-C

    + (nonnull instancetype)
        alertControllerWithCustomActionSequenceView:
            (nonnull UIView *)customActionSequenceView
                                              title:(nullable NSString *)title
                                            message:(nullable NSString *)message
                                     preferredStyle:
                                         (FWAlertControllerStyle)preferredStyle
                                      animationType:
                                          (FWAlertAnimationType)animationType;

    Parameters

    customActionSequenceView

    action部分的自定义view

    title

    大标题

    message

    副标题

    preferredStyle

    对话框样式

    animationType

    动画类型

    Return Value

    控制器对象

  • 更新自定义view的size,比如屏幕旋转,自定义view的大小发生了改变,可通过该方法更新size

    Declaration

    Objective-C

    - (void)updateCustomViewSize:(CGSize)size;