美文网首页
NYSTK(iOS炫彩弹框框架)

NYSTK(iOS炫彩弹框框架)

作者: 泥剛 | 来源:发表于2021-03-05 07:58 被阅读0次
logo.png

ios 炫彩弹框
ios colorful alert framework

GitHub address: https://github.com/niyongsheng/NYSTK

Usage:

  • Installation with CocoaPods:pod 'NYSTK','~>0.0.6'
  • Import the main file:#import <NYSTK/NYSTK.h>


  • Manual import:Drag NYSTK folder to project
  • Import the main file:#import "NYSTK.h"

Screenshot:

nystk_demo_1.gif nystk_demo_2.gif

APIs:

#pragma mark - Toast
/// 纯文本toast
/// @param message 提示文本
/// @param theme 主题样式
+ (void)showToastWithMessage:(NSString *)message themeModel:(NYSTKThemeModel)theme;

/// 图文toast提示
/// @param message 提示样式
/// @param imageName 提示图
/// @param theme 主题样式
+ (void)showToastWithMessage:(NSString *)message image:(NSString *)imageName themeModel:(NYSTKThemeModel)theme;

/// 炫彩弹框
/// @param message 信息
/// @param type 类型
/// @param direction 进入方向
/// @param view 作用域
/// @param theme 主题样式
+ (void)showColorfulToastWithMessage:(NSString *)message
                                type:(NYSTKColorfulToastType)type
                           direction:(NYSTKComeInDirection)direction
                              onView:(UIView *)view
                          themeModel:(NYSTKThemeModel)theme;

#pragma mark - 带block回调的签到弹窗
/// 签到弹框
/// @param signMessageText 富文本
/// @param view 作用域
/// @param type 类型
/// @param emitter 粒子样式
/// @param theme 主题样式
/// @param infoButtonClickedBlock 详情回调
/// @param closeButtonClickedBlock 关闭回调
+ (void)showSignAlertWithMessage:(NSAttributedString *)signMessageText
                          onView:(UIView *)view
                        signType:(NYSTKSignType)type
                     emitterType:(NYSTKEmitterAnimationType)emitter
                      themeModel:(NYSTKThemeModel)theme
          infoButtonClickedBlock:(void(^)(void))infoButtonClickedBlock
         closeButtonClickedBlock:(void(^)(void))closeButtonClickedBlock;

/// 网络图片弹框
/// @param imageURL 图片url
/// @param contentMode 显示方式
/// @param size 尺寸
/// @param view 作用域
/// @param emitter 粒子样式
/// @param theme 主题样式
/// @param infoButtonClickedBlock 详情回调
/// @param closeButtonClickedBlock 关闭回调
+ (void)showAlertWithImageURL:(NSURL *)imageURL
                  contentMode:(UIViewContentMode)contentMode
                         size:(CGSize)size
                       onView:(UIView *)view
                  emitterType:(NYSTKEmitterAnimationType)emitter
                   themeModel:(NYSTKThemeModel)theme
       infoButtonClickedBlock:(void(^)(void))infoButtonClickedBlock
      closeButtonClickedBlock:(void(^)(void))closeButtonClickedBlock;

/// 信息弹框
/// @param title 标题
/// @param message 信息
/// @param view 作用域
/// @param type 成功/失败/警告
/// @param colorType 颜色
/// @param emitter 粒子效果
/// @param theme 主题
/// @param infoButtonClickedBlock 详情回调
/// @param closeButtonClickedBlock 关闭回调
+ (void)showMessageWithTitle:(NSString *)title
                     message:(NSAttributedString *)message
                      onView:(UIView *)view
                    type:(NYSTKMessageType)type
                   colorType:(NYSTKMessageColorType)colorType
                 emitterType:(NYSTKEmitterAnimationType)emitter
                  themeModel:(NYSTKThemeModel)theme
      infoButtonClickedBlock:(void(^)(void))infoButtonClickedBlock
     closeButtonClickedBlock:(void(^)(void))closeButtonClickedBlock;

/// 提示弹框
/// @param title 标题
/// @param message 信息
/// @param time 时间
/// @param btnTitle 确认按钮标题
/// @param view 作用域
/// @param type 类型
/// @param emitter 粒子效果
/// @param theme 主题
/// @param infoButtonClickedBlock 详情回调
/// @param closeButtonClickedBlock 关闭回调
+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSAttributedString *)message
                      time:(NSString *)time
              infoBtnTitle:(NSString *)btnTitle
                    onView:(UIView *)view
                      type:(NYSTKAlertType)type
               emitterType:(NYSTKEmitterAnimationType)emitter
                themeModel:(NYSTKThemeModel)theme
    infoButtonClickedBlock:(void(^)(void))infoButtonClickedBlock
   closeButtonClickedBlock:(void(^)(void))closeButtonClickedBlock;

Instance:

// simple toast
[NYSTKAlert showToastWithMessage:@"NYSTK toast test !" themeModel:self.tintModel];

// colorful toast
[NYSTKAlert showColorfulToastWithMessage:@"NYSTK colorful toast test ..."
                                    type:NYSTKColorfulToastTypeBlueFlower
                               direction:NYSTKComeInDirectionUp
                                  onView:[UIApplication sharedApplication].delegate.window
                              themeModel:self.tintModel];

// custom alert
[NYSTKAlert showAlertWithTitle:@"查看优惠券"
                       message:[[NSAttributedString alloc] initWithString:@"激活码:MVBCQ-B3VPW-CT369"]
                          time:@"有效期:2020-09-07"
                  infoBtnTitle:@"确定"
                        onView:self.view
                          type:NYSTKAlertTypeDefault
                   emitterType:NYSTKEmitterAnimationTypeColourbar
                    themeModel:self.tintModel
                    infoButtonClickedBlock:^{

} closeButtonClickedBlock:^{

}]; 

Remind

  • ARC
  • iOS >= 10.0
  • iPhone \ iPad screen anyway

Contact Me

相关文章

网友评论

      本文标题:NYSTK(iOS炫彩弹框框架)

      本文链接:https://www.haomeiwen.com/subject/qdykqltx.html