# YFMessage **Repository Path**: Dandre/YFMessage ## Basic Information - **Project Name**: YFMessage - **Description**: 对UIAlertController和MBProgressHUD的二次封装,实现一句代码快速调用 - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 9 - **Forks**: 0 - **Created**: 2019-05-10 - **Last Updated**: 2025-08-06 ## Categories & Tags **Categories**: ios-modules **Tags**: None ## README ## YFMessage [![Build Status](https://travis-ci.org/DandreYang/YFMessage.svg?branch=master)](https://travis-ci.org/DandreYang/YFMessage) [![Version](https://img.shields.io/cocoapods/v/YFMessage.svg?style=flat)](http://cocoapods.org/pods/YFMessage) [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/DandreYang/YFMessage/master/LICENSE) [![Platform](https://img.shields.io/cocoapods/p/YFMessage.svg?style=flat)](http://cocoapods.org/pods/YFMessage) > 对UIAlertController和MBProgressHUD的二次封装,实现一句代码快速调用 ## CocoaPods ```ruby pod 'YFMessage' ``` ## 相关方法 ```objc @interface YFMessage (AlertView) /** alert提示框待UIAlertController返回值 @param message 提示内容 @param title 提示标题 @param style alert类型 @param actions UIAlertAction对象的集合 @return 返回UIAlertController对象 */ + (UIAlertController *_Nonnull)alert:(NSString *_Nullable)message title:(NSString *_Nullable)title style:(UIAlertControllerStyle)style actions:(NSArray *_Nullable)actions; /** alert提示框待UIAlertController返回值 @param message 提示内容 @param title 提示标题 @param style alert类型 @param cancelActionTitle 取消按钮标题 @param actionTitles 其他按钮标题的集合 @param callback 点击按钮时的回调 @return 返回UIAlertController对象 */ + (UIAlertController *_Nonnull)alert:(NSString *_Nullable)message title:(NSString *_Nullable)title style:(UIAlertControllerStyle)style cancelActionTitle:(NSString *_Nullable)cancelActionTitle otherActionTitles:(NSArray *_Nullable)actionTitles clickedBack:(void(^_Nullable)(NSString *_Nonnull actionTitle, NSInteger actionIndex))callback; /** alert提示框 @param message 提示的内容,可以是对象,如数组 */ + (void)alert:(id _Nullable)message; /** alert提示框 @param message 提示的内容,可以是对象,如数组 @param title 提示的标题 */ + (void)alert:(NSString * _Nullable)message title:(NSString *_Nullable)title; /** alert提示框 @param message 提示的内容 @param cancelTitle 取消按钮标题 @param conformTitle 确认按钮标题 @param callback 点击按钮后的回调 */ + (void)alert:(NSString *_Nullable)message cancelTitle:(NSString *_Nullable)cancelTitle conformTitle:(NSString *_Nullable)conformTitle clickedBack:(void(^_Nullable)(NSString *_Nonnull actionTitle, NSInteger actionIndex))callback; /** alert提示框 @param message 提示的内容 @param title 提示的标题 @param cancelTitle 取消按钮标题 @param conformTitle 确认按钮标题 @param callback 点击按钮后的回调 */ + (void)alert:(NSString *_Nullable)message title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle conformTitle:(NSString *_Nullable)conformTitle clickedBack:(void(^_Nullable)(NSString *_Nonnull actionTitle, NSInteger actionIndex))callback; /** 带一个输入框的alert提示框 @param title 提示标题 @param message 提示内容 @param cancelTitle 取消按钮标题 @param conformTitle 确认按钮文本 @param textFieldConfigHandler 输入框的配置闭包 @param callback 点击按钮时的回调 */ + (void)alertEditViewWithTitle:(NSString *_Nullable)title message:(NSString *_Nullable)message cancelTitle:(NSString *_Nullable)cancelTitle conformTitle:(NSString *_Nullable)conformTitle textFieldConfigHandler:(void(^_Nullable)(UITextField * _Nonnull textField))textFieldConfigHandler clickedBack:(void(^_Nullable)(NSString * _Nonnull actionTitle, NSInteger actionIndex))callback; /** 支持自定义内容对齐方式的alert提示框 @param message 提示内容 @param title 提示标题 @param cancelTitle 取消按钮标题 @param conformTitle 确认按钮标题 @param textAlign 内容对齐方式 @param callback 点击按钮时的回调 */ + (void)alert:(id _Nullable)message title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle conformTitle:(NSString *_Nullable)conformTitle textAlign:(NSTextAlignment)textAlign clickedBack:(void(^_Nullable)(NSString * _Nonnull actionTitle, NSInteger actionIndex))callback; @end @interface YFMessage (MBProgressHUD) /** * 可以自动隐藏的提示 * * @param message 提示的内容 * @param view 提示视图要显示在的视图 * @param flag 是否自动隐藏 */ + (void)show:(id _Nullable )message onView:(UIView *_Nonnull)view autoHidden:(BOOL)flag; /** * 显示HUD提示 * * @param message 提示的文字 * @param image 提示的image * @param viewController delegate * @param autoHidden 是否自动隐藏 */ + (void)show:(id _Nullable )message image:(UIImage *_Nullable)image delegate:(__kindof UIViewController *_Nonnull)viewController autoHidden:(BOOL)autoHidden; /** * 创建并显示小菊花 */ + (void)showActiveViewOnView:(UIView *_Nonnull)view; + (void)showActiveViewWithTipString:(NSString *_Nullable)tipString onView:(UIView *_Nonnull)view; /** * 小菊花-无超时限制 */ + (void)showActiveViewMessage:(NSString *_Nonnull)tipString onView:(UIView *_Nonnull)view; /** * 隐藏小菊花 */ + (void)hideActiveView; @end ``` ## License YFMessage is released under the MIT license. See [LICENSE](./LICENSE) for details.