打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
swift版本提示框XLProgressHUD 指示器
         由于公司项目开始转为swift版本,ProgressHUD目前网上也没有很好的swift版本,自己模仿OC的toast写的一个swift版本。可以使用CocoaPods集成在项目中,使用非常简单方便。如有问题的地方还请各位大神多多指点。如果对你有用,可以star下,谢谢!

swift版本指示器,基本所有项目中都会用到的。功能和OC版本的toast、MBProgressHUD基本相同、

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods
To integrate XLProgressHUD into your Xcode project using CocoaPods, specify it in your 'Podfile' :

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '' do
pod 'XLProgressHUD', '~> 1.0.5'
end
Then, run the following command:

$ pod install
Usage

Introduce

import XLProgressHUD
Use Code

1、单独内容信息提示

let message = "修改成功"
view.showMessage(message, interval: 0.2, position: "top")
2、内容信息 + 图片 提示

let message = "修改成功"
view.showMessageAndImage(message, image: UIImage(named: "true_icon"), interval: 0.2, position: "center")
3、标题信息 + 内容信息 + 图片 提示

let title = "+2"
let message = "恭喜你!
答对了"
view.showTitleMessageAndImage(title, message: message, image: UIImage(named: "coins_big_icon"), interval: 0.2, position: "bottom")
4、网络请求持久显示提示

let message = "加载中..."
view.showLoadingTilteActivity(message, position: "center")
// 模拟网络数据加载设置的显示时间
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(1 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) { () -> Void in

// 隐藏提示视图
self.view.hideActivity()
}
Parameter description

title: 显示提示框上部的文字参数
message: 显示提示下部的文字提示框
image: 显示提示框里面的图片参数
interval: 显示提示框显示时间的参数
position: 显示提示框显示位置 使用填入参数为("top" "center" "bottom") 默认为nil时现在在中部位置    
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
在cocoapods 0.36.4版本下 加入xmppframework 
如何使用Carthage管理iOS依赖库
CocoaPods 0.36正式发布,实现Swift和iOS 8动态框架支持
错误消息Number not in interval XXX when downloading
Xcode:为你的项目集成单元测试(unit tests)时记得避开这些坑
前端学习之iOS开发(二) | 有道技术沙龙博客
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服