https://github.com/iliuchang/lctoast
Simple Objective-C toast notifications
https://github.com/iliuchang/lctoast
ios objective-c progress toast
Last synced: 5 months ago
JSON representation
Simple Objective-C toast notifications
- Host: GitHub
- URL: https://github.com/iliuchang/lctoast
- Owner: iLiuChang
- License: mit
- Created: 2022-06-08T06:53:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-27T04:12:20.000Z (over 3 years ago)
- Last Synced: 2025-04-14T04:07:12.386Z (11 months ago)
- Topics: ios, objective-c, progress, toast
- Language: Objective-C
- Homepage:
- Size: 287 KB
- Stars: 164
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LCToast
Add toast to UIView.
## Requirements
- **iOS 8.0+**
## Features
The LCToast is a comparison of features with [Toast](https://github.com/scalessec/Toast) and [SVProgressHUD](https://github.com/SVProgressHUD/SVProgressHUD).
| | LCToast | Toast | SVProgressHUD |
| :-----------------------------------------: | :--------: | :---------: | :-----------: |
| image position | top center | left center | top center |
| superview | any views | any views | UIWindow |
| automatic calculation text time interval | ✅ | ❌ | ✅ |
| dismiss activity when toast shown | ✅ | ❌ | ✅ |
| activity/progress support the message | ✅ | ❌ | ✅ |
| modify offset | ❌ | ✅ | ✅ |
| progress | ✅ | ❌ | ✅ |
| subtitle | ❌ | ✅ | ❌ |
| queue | ✅ | ✅ | ❌ |
| support for disabling superview interaction | ✅ | ❌ | ✅ |
## Usage
### show toast
```objective-c
[self.view lc_showToast:@"床前明月光,疑是地上霜。举头望明月,低头思故乡。"];
```
| LCToastPositionTop | LCToastPositionCenter | LCToastPositionBottom |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
|  |  |  |
### show image toast
```objective-c
[self.view lc_showToast:@"春种一粒粟,秋收万颗子。四海无闲田,农夫犹饿死。锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。" image:[UIImage imageNamed:@"warning"] position:(LCToastPositionCenter)];
```

### show activity toast
```objective-c
[self.view lc_showActivityToast:@"加载中..."];
```

### show progress toast
```objective-c
[self.view lc_showProgressToast:0.7 message:@"下载中..."];
```

## Installation
### CocoaPods
To integrate LCToast into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
pod 'LCToast'
```
### Manual
1. Download everything in the LCToast folder;
2. Add (drag and drop) the source files in LCToast to your project;
3. Import `UIView+LCToast.h`.
## License
LCToast is provided under the MIT license. See LICENSE file for details.