Library for adding tags shaped as ribbons to existing views
Copy this line into your Cartfile
github "ricardrm88/RicRibbonTag"
After that run the following command on your Cartfile directory
carthage update RicRibbonTag
Add to your Podfile
platform :ios, "8.1"
use_frameworks!
target 'Test' do
pod 'RicRibbonTag'
end
Then run the following line on your project folder:
pod install
After that just include RicRibbonTag in your file to use it
import RicRibbonTag
Just copy RicRibbonLabel.swift and RicRibbonTag.swift to your project
let ribbon = RicRibbon()
ribbon.type = .topLeftCorner
ribbon.label.text = "20% Discount"
ribbon.originDistance = 40
ribbon.ribbonWidth = 40
ribbon.label.textColor = .white
ribbon.wrap(containerView)
Label rendered inside the label, it can be used to modify it's text and font. It's frame, origin and transform are modified internally and shouldn't be edited
Size of the decoration at the outer edges of the ribbon, clipstobounds should be disabled in the parent view for them to be visible
Width of the ribbon, it's ignored if autoresizes is enabled
Color that the ribbon will be displayed with
Color of the margin of the ribbon
Width of the margin of the ribbon
Distance from the reference point of the container view to the closest point of the ribbon
Length of the ribbon, will only work with .Left .Right and .Top types
If enabled originDistance and ribbon width may be modified to keep the ribbon in the container bounds
If enabled, it will move the ribbon horizontally when needed to keep the whole ribbon inside of the container bounds
If enabled the ribbon will cast a shadow
If enabled it will display decorators at the outer edges of the ribbon, clipstobounds should be disabled in the parent view for them to be visible
It determines the position of the ribbon in the container, it allows the following values:
enum RibbonType {
case TopLeftCorner
case TopRightCorner
case BottomLeftCorner
case BottomRightCorner
case Left
case Right
case Top
}
####autoresizePadding Padding added between the ribbon and it's label when autoresizes is enabled
####autoresizes When enabled the ribbon width will equal it's label height
Used to wrap a view with the current ribbon
Sets a dash pattern as the margin of the ribbon where lineWidth will be the stripe length and spaceWidth will be the length of the space between stripes
MIT License
Copyright (c) 2016 Ricard Romeo Murgó (https://github.com/ricardrm88)
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.