https://github.com/only-icesoul/ios-jjbadge
Simple Badge
https://github.com/only-icesoul/ios-jjbadge
Last synced: 3 months ago
JSON representation
Simple Badge
- Host: GitHub
- URL: https://github.com/only-icesoul/ios-jjbadge
- Owner: Only-IceSoul
- License: apache-2.0
- Created: 2020-03-16T19:56:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T20:14:37.000Z (about 5 years ago)
- Last Synced: 2025-02-23T04:01:38.165Z (3 months ago)
- Language: Swift
- Size: 207 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JJBadge
Simple Badge
[](https://cocoapods.org/pods/JJBadge)
[](https://cocoapods.org/pods/JJBadge)
[](https://cocoapods.org/pods/JJBadge)## Requirements
```
IOS Deployment Target 12.0+
```
## InstallationJJBadge is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'JJBadge'
```## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Preview
## Creating a badge in the Storyboard
* Drag a UIView to your view.
* Set its class to JJBadgeView in identity inspector.
* Set the module property to JJBadge
## Creating a badge from the code
```Swift
import JJBadgelet badge = JJBadgeView()
view.addSubview(badge)
```## Customization
| Name | description | type | default |
| --- | --- | --- | --- |
| setText | set the text | String | "99+" |
| setTextSize | Set the text size | CGFloat | 15 |
| setFont | name sample: ("Roboto") | String | System Font |
| setTextColor | Set a color for the text | UIColor | white |
| setStrokeColor | Set a color for the stroke | UIColor | black |
| setStrokeWidth | Set a width for the stroke | CGFloat | 0 |
| setIsTextHidden | Make text visible or hidden | Bool | false |
| setTextOffsetX | move the text - axis X | CGFloat | -0 |
| setTextOffsetY | move the text - axis Y | CGFloat | -0 |
| setInsetX | wrapContent inset axis X | CGFloat | -0 |
| setInsetY | wrapContent inset axis Y | CGFloat | -0 |
| setBackgroundColor | backgroundColor | UIColor | red |## Size
using constraints
| Name | description | equal
| --- | --- | --- |
| width | undefined | Wrap Content |
| height | undefined | Wrap Content |