1 Star 0 Fork 2

木子歆 / XHToast

forked from 朱晓辉 / XHToast 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

XHToast

简洁轻便提示工具,一行代码,既可完成提示信息显示.

AppVeyor Carthage compatible Version Status Support Pod Platform Pod License

==============

Swift版本请戳这里>>> https://github.com/CoderZhuXH/XHToastSwift

技术交流群(群号:537476189)

效果

image

使用方法

1.普通调用

    
    //您只需要调用一行代码,既可完成提示信息显示
 
    //1.在window上显示toast

    /**
    中间显示
    */
    [XHToast showCenterWithText:@"您要显示的提示信息"];

    /*
    上方显示
    */
    [XHToast showTopWithText:@"您要显示的提示信息"];

    /*
    下方显示
    */
    [XHToast showBottomWithText:@"您要显示的提示信息"];


    //2.你也可以这样调用,在view上显示toast

    /**
    *  中间显示
    */
    [self.view showXHToastCenterWithText:@"您要显示的提示信息"];

    /**
    *  上方显示
    */
    [self.view showXHToastTopWithText:@"您要显示的提示信息"];

    /**
    *  下方显示
    */
    [self.view showXHToastBottomWithText:@"您要显示的提示信息"];

2.自定义Toast停留时间+到屏幕上端/下端距离(见如下方法)

1.显示至window(通过XHToast调用)

#pragma mark-中间显示

/**
*  中间显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
+ (void)showCenterWithText:(NSString *)text duration:(CGFloat)duration;

#pragma mark-上方显示

/**
*  上方显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
+ (void)showTopWithText:(NSString *)text duration:(CGFloat)duration;

/**
*  上方显示+自定义距顶端距离
*
*  @param text      内容
*  @param topOffset 到顶端距离
*/
+ (void)showTopWithText:(NSString *)text topOffset:(CGFloat)topOffset;

/**
*  上方显示+自定义距顶端距离+自定义停留时间
*
*  @param text      内容
*  @param topOffset 到顶端距离
*  @param duration  停留时间
*/
+ (void)showTopWithText:(NSString *)text topOffset:(CGFloat)topOffset duration:(CGFloat)duration;

#pragma mark-下方显示

/**
*  下方显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
+ (void)showBottomWithText:(NSString *)text duration:(CGFloat)duration;

/**
*  下方显示+自定义距底端距离
*
*  @param text         内容
*  @param bottomOffset 距底端距离
*/
+ (void)showBottomWithText:(NSString *)text bottomOffset:(CGFloat)bottomOffset;

/**
*  下方显示+自定义距底端距离+自定义停留时间
*
*  @param text         内容
*  @param bottomOffset 距底端距离
*  @param duration     停留时间
*/
+ (void)showBottomWithText:(NSString *)text bottomOffset:(CGFloat)bottomOffset duration:(CGFloat)duration;

2.在view上显示(通过view调用)

#pragma mark-中间显示

/**
*  中间显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
- (void)showXHToastCenterWithText:(NSString *)text duration:(CGFloat)duration;

#pragma mark-上方显示

/**
*  上方显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
- (void)showXHToastTopWithText:(NSString *)text duration:(CGFloat)duration;

/**
*  上方显示+自定义距顶端距离
*
*  @param text      内容
*  @param topOffset 到顶端距离
*/
- (void)showXHToastTopWithText:(NSString *)text topOffset:(CGFloat)topOffset;

/**
*  上方显示+自定义距顶端距离+自定义停留时间
*
*  @param text      内容
*  @param topOffset 到顶端距离
*  @param duration  停留时间
*/
- (void)showXHToastTopWithText:(NSString *)text topOffset:(CGFloat)topOffset duration:(CGFloat)duration;

#pragma mark-下方显示

/**
*  下方显示+自定义停留时间
*
*  @param text     内容
*  @param duration 停留时间
*/
- (void)showXHToastBottomWithText:(NSString *)text duration:(CGFloat)duration;

/**
*  下方显示+自定义距底端距离
*
*  @param text         内容
*  @param bottomOffset 距底端距离
*/
- (void)showXHToastBottomWithText:(NSString *)text bottomOffset:(CGFloat)bottomOffset;

/**
*  下方显示+自定义距底端距离+自定义停留时间
*
*  @param text         内容
*  @param bottomOffset 距底端距离
*  @param duration     停留时间
*/
- (void)showXHToastBottomWithText:(NSString *)text bottomOffset:(CGFloat)bottomOffset duration:(CGFloat)duration;

安装

1.手动添加:

  • 1.将 XHToast 文件夹添加到工程目录中
  • 2.导入 XHToast.h

2.CocoaPods:

  • 1.在 Podfile 中添加 pod 'XHToast'
  • 2.执行 pod install 或 pod update
  • 3.导入 XHToast.h

3.Tips

  • 1.如果发现pod search XHToast 搜索出来的不是最新版本,需要在终端执行cd desktop退回到desktop,然后执行pod setup命令更新本地spec缓存(需要几分钟),然后再搜索就可以了
  • 2.如果你发现你执行pod install后,导入的不是最新版本,请删除Podfile.lock文件,在执行一次 pod install

系统要求

  • 该项目最低支持 iOS 7.0 和 Xcode 7.0

许可证

XHToast 使用 MIT 许可证,详情见 LICENSE 文件

The MIT License (MIT) Copyright (c) 2015-2016 XHToast (https://github.com/CoderZhuXH/XHToast) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

简洁轻便提示工具,一行代码既可完成提示信息显示 - 支持自定义显示位置及停留时间 展开 收起
Objective-C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/qqqwww123123123/XHToast.git
git@gitee.com:qqqwww123123123/XHToast.git
qqqwww123123123
XHToast
XHToast
master

搜索帮助