# AlertBar
[![Version](https://img.shields.io/cocoapods/v/AlertBar.svg?style=flat)](http://cocoapods.org/pods/AlertBar)
[![License](https://img.shields.io/cocoapods/l/AlertBar.svg?style=flat)](http://cocoapods.org/pods/AlertBar)
[![Platform](https://img.shields.io/cocoapods/p/AlertBar.svg?style=flat)](http://cocoapods.org/pods/AlertBar)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
An easy alert on status bar.
| Demo |
| :---: |
| ![demo](./assets/demo.gif) |
## Usage
### Import
```swift
import AlertBar
```
### Show alert message
AlertBar has default types:
- success
- error
- notice
- warning
- info
```swift
AlertBar.show(type: .success, message: "This is a Success message.")
```
And you can customize the background and text colors of AlertBar.
Select `custom` type and set background and text colors as UIColor: `.custom(BackgroundColor, TextColor)`
```swift
AlertBar.show(type: .custom(.lightGray, .black), message: "This is a Custom message.")
```
#### Alert duration
AlertBar accepts to custom alert duration.
```swift
AlertBar.show(type: .success, message: "This is a Success message.", duration: 10)
```
### AlertBar Options
AlertBar accepts options follows:
- Consider Safe Area
- Stretch bar
- TextAlignment
Use `setDefault` method to set default options.
```swift
let options = AlertBar.Options(
shouldConsiderSafeArea: true,
isStretchable: true,
textAlignment: .center,
font: UIFont.systemFont(ofSize: 14.0, weight: .medium)
)
AlertBar.setDefault(options: options)
```
Or set parameter of `show` method to each AlertBar.
```swift
let options = AlertBar.Options(
shouldConsiderSafeArea: true,
isStretchable: true,
textAlignment: .center,
font: UIFont.systemFont(ofSize: 14.0, weight: .medium)
)
AlertBar.show(type: .success, message: "This is AlertBar!", options: options)
```
### Consider Safe Area
The Safe Area is adopted from iOS 11 and AlertBar can change whether to consider SafeArea or not.
`AlertBar.Options#shouldConsiderSafeArea: Bool`
is set to `true` by default.
| `shouldConsiderSafeArea == true` | `shouldConsiderSafeArea == false` |
| :---: | :---: |
| ![true](./assets/shouldConsiderSafeArea_true.png) | ![false](./assets/shouldConsiderSafeArea_false.png) |
### Stretch bar
AlertBar can stretch the bar if the message needs the multi lines.
`AlertBar.Options#isStretchable: Bool`
is set to `false` by default.
| `isStretchable == true` | `isStretchable == false` |
| :---: | :---: |
| ![true](./assets/isStretchable_true.png) | ![false](./assets/isStretchable_false.png) |
#### TextAlignment
AlertBar accepts to custom text alignment.
## Installation
### CocoaPods
AlertBar is available through [CocoaPods](http://cocoapods.org).
To install it, simply add the following line to your Podfile:
```ruby
pod "AlertBar"
```
### Carthage
AlertBar is available through [Carthage](https://github.com/Carthage/Carthage) since `0.3.1`.
To install it, simply add the following line to your Cartfile:
```
github "jinSasaki/AlertBar"
```
## Author
Jin Sasaki, sasakky_j@gmail.com
## License
AlertBar is available under the MIT license. See the LICENSE file for more info.
没有合适的资源?快使用搜索试试~ 我知道了~
状态栏上的简单警报_Swift_Perl_下载.zip
共30个文件
swift:4个
png:4个
plist:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 62 浏览量
2023-04-05
12:59:59
上传
评论
收藏 673KB ZIP 举报
温馨提示
状态栏上的简单警报_Swift_Perl_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
状态栏上的简单警报_Swift_Perl_下载.zip (30个子文件)
AlertBar-master
AlertBar.xcodeproj
xcshareddata
xcschemes
AlertBar.xcscheme 4KB
project.pbxproj 16KB
project.xcworkspace
xcshareddata
IDEWorkspaceChecks.plist 238B
contents.xcworkspacedata 153B
.swift-version 6B
AlertBar.podspec 635B
.travis.yml 490B
assets
shouldConsiderSafeArea_false.png 28KB
shouldConsiderSafeArea_true.png 28KB
isStretchable_false.png 29KB
isStretchable_true.png 29KB
demo.gif 1.07MB
Makefile 202B
LICENSE 1KB
Example
AlertBarExample
Base.lproj
Main.storyboard 7KB
LaunchScreen.storyboard 2KB
AppDelegate.swift 2KB
ViewController.swift 1KB
Info.plist 1KB
Assets.xcassets
AppIcon.appiconset
Contents.json 585B
AlertBarExample.xcodeproj
project.pbxproj 12KB
project.xcworkspace
contents.xcworkspacedata 160B
Sources
AlertBar.swift 9KB
AlertBarTests
Info.plist 680B
AlertBarTests.swift 974B
.gitignore 618B
README.md 3KB
AlertBar
Info.plist 753B
AlertBar.h 490B
scripts
sort-Xcode-project-file 6KB
共 30 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功