Coder Social home page Coder Social logo

vinxphx / easyshowview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chenliangloveyou/easyshowview

0.0 1.0 0.0 5.54 MB

一款非常简单的展示工具。提示框,加载框,alert弹出框。一行代码搞定所有操作。

License: MIT License

Ruby 0.83% Objective-C 99.17%

easyshowview's Introduction

EasyShowView

一款超级简单的展示工具,包括吐丝指示器,loding加载框,alertview,actionsheet的定制。可自定义动画,显示样式等各种操作,使各种展示更加easy。简单到爆。赶紧来试试吧~~~"

  • (支持cocoapods: pod 'EasyShowView','~>1.0.0')

PreView

githubgithubgithub

使用方法

一、提示框

显示一个纯文字消息

+ (void)showText:(NSString *)text ;
+ (void)showText:(NSString *)text inView:(UIView *)view ;//这个view为父视图如果不传将会加载window上。显示时间的长短根据text的长度计算的。

显示一个成功消息

+ (void)showSuccessText:(NSString *)text ;
+ (void)showSuccessText:(NSString *)text inView:(UIView *)view ;//view和上面介绍的一样

显示一个错误消息

+ (void)showErrorText:(NSString *)text ;
+ (void)showErrorText:(NSString *)text inView:(UIView *)superView ;

显示一个提示消息

+ (void)showInfoText:(NSString *)text ;
+ (void)showInfoText:(NSString *)text inView:(UIView *)superView ;

显示一个自定义图片消息

+ (void)showImageText:(NSString *)text imageName:(NSString *)imageName ;
+ (void)showImageText:(NSString *)text imageName:(NSString *)imageName inView:(UIView *)superView ;

自定义样式(可略)

最好在APPdelegate里设置一次(整个APP应该统一风格)。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   
  EasyShowOptions *options = [EasyShowOptions sharedEasyShowOptions];
   
 //在展示消息的时候,界面上是否可以事件。默认为YES,如果你想在展示消息的时候不让用户有手势交互,可设为NO
 options.textSuperViewReceiveEvent = NO ;

 //显示/隐藏的动画形式。有无动画,渐变,抖动,三种样式。
 options.textAnimationType = TextAnimationTypeFade ;

 //提示框所在的位置。有上,中,下,状态栏上,导航条上,五种选择。
 options.textStatusType = ShowTextStatusTypeMidden ;

 //文字大小
 options.textTitleFount = [UIFont systemFontOfSize:15] ;
 //文字颜色
 options.textTitleColor = [UIColor whiteColor] ;
 //背景颜色
 options.textBackGroundColor = [UIColor blackColor];
 //阴影颜色。(为clearcolor的时候不显示阴影)
 options.textShadowColor = [UIColor blueColor];

 return YES ;
}

二、加载框

显示加载框

/**
 * 显示一个加载框
 * text:需要显示加载框的字体
 * imageName:需要显示加载框的图片名称
 * superview:加载框所需要的父视图(如果不传会放到window和topviewcontroller上面,在EasyShowOptions里指定)
 */
+ (void)showLoding ;
+ (void)showLodingText:(NSString *)text ;
+ (void)showLodingText:(NSString *)text inView:(UIView *)superView ;
+ (void)showLodingText:(NSString *)text imageName:(NSString *)imageName ;
+ (void)showLodingText:(NSString *)text imageName:(NSString *)imageName inView:(UIView *)superView ;

隐藏加载框

/**
 * 移除一个加载框
 * uperview:加载框所在的父视图。show的时候没有指定父视图。那么隐藏的时候也不用
 */
+ (void)hidenLoding ;
+ (void)hidenLoingInView:(UIView *)superView ;

自定义样式(可略)

最好在APPdelegate里设置一次。与上面的提示框一起设置

  //在展示消息的时候,界面上是否可以事件。默认为YES,如果你想在展示消息的时候不让用户有手势交互,可设为NO
  options.lodingSuperViewReceiveEvent = NO ;

  //加载框的样式。在这个枚举中一共有10中样式。如果是显示图片加载,那么加载框的大小会根据图片的大小调整。__☺☺试试把图片传很小,不显示文字,背景为透明色是什么效果☺☺__
  options.lodingShowType = LodingShowTypeTurnAround ;

  //显示/隐藏的动画形式。有无动画,渐变,抖动,三种样式。
  options.lodingAnimationType = LodingAnimationTypeFade ;

  //文字大小
  options.lodingTextFount = [UIFont systemFontOfSize:15];
  //主体颜色(包括图片,文字颜色)
  options.lodingTintColor = [UIColor blackColor];
  //背景颜色,试试传透明色是什么效果
  options.lodingBackgroundColor = [UIColor lightGrayColor];
  //当不传superView的时候,父视图默认有window和最上面的控制器。这里设置是否显示在wind上
  options.lodingShowOnWindow = NO ;
  //圆角大小
  options.lodingCycleCornerWidth = 5 ;
  

三、AlertView/ActionSheet弹出框

一:自定义形式

第一步 创建一个弹出框

//创建AlertView
+ (instancetype)showAlertWithTitle:(NSString *)title
                           message:(NSString *)message ;
//ActionSheet
+ (instancetype)showActionSheetWithTitle:(NSString *)title
                                 message:(NSString *)message ;

第二步 往弹出框上添加事件

- (void)addItemWithTitle:(NSString *)title
                itemType:(ShowAlertItemType)itemType
                callback:(alertItemCallback)callback;

第三步 展示弹出框(不可少)

- (void)show ;

二:系统形式

与自定义的形式。把show后面加一个system。可参考实例。

自定义样式(可略)

最好在APPdelegate里设置一次。与上面的提示框一起设置

/**
 *alertview的背景颜色。
 * title/message的字体颜色
 */
@property (nonatomic,strong)UIColor *alertTintColor ;
@property (nonatomic,strong)UIColor *alertTitleColor ;
@property (nonatomic,strong)UIColor *alertMessageColor ;

/**
 * alertView:是两个按钮的时候 横着摆放
 */
@property (nonatomic,assign)BOOL alertTowItemHorizontal ;

/**
 * alertView:展示和消失的动画类型。
 * 当展示的是系统alertview和ActionSheet不起作用
 */
@property (nonatomic,assign)alertAnimationType alertAnimationType ;

/**
 * 点击alertview之外的空白区域,是否销毁alertview。默认为:NO
 *
 * 系统的alert        不可以点击销毁。
 * 系统的ActionSheet  添加UIAlertActionStyleCancel类型就会有点击销毁。没有就不会销毁。
 */
@property (nonatomic,assign)BOOL alertBgViewTapRemove ;

联系作者

  • 若果在使用过程中发现问题,请提issue。我会及时解决。
  • 如果想和我交流开发经验,或者关于库的任何问题,可以联系我。邮箱:[email protected]   qq:455158249
  • 喜欢欢迎start~~~~

easyshowview's People

Contributors

chenliangloveyou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.