Home

Awesome

<p align="center"><img src="graphics/logotype-a.png"></p>

A triangle shaped corner label view for iOS written in Swift.

<br> <br>

<img src='https://raw.githubusercontent.com/mukeshthawani/TriLabelView/master/graphics/first_example.png' width='450' alt='TriLabelView'> <img src='https://raw.githubusercontent.com/mukeshthawani/TriLabelView/master/graphics/second_example.png' width='450' alt='TriLabelView'>

Setup with CocoaPods

If you are using CocoaPods add this text to your Podfile and run pod install.

use_frameworks!
target 'Your target name'
pod 'TriLabelView'

Or Add source

Simply add TriLabelView.swift file to you project.

Usage

Creating a view from the code

let triLabelView = TriLabelView(frame:CGRect)
view.addSubview(triLabelView)

Customization

// Change Text
triLabelView.labelText = "NEW"

// Adjust Length Percentage
// You can update this to set percentage value of this
// view to that of the superview.
// Default value is 50.0
triLabelView.lengthPercentage = 60.0

You can set the position of view with .TopLeft being the default. The following positions are available

public enum Position:String {
    case TopLeft
    case TopRight
    case BottomRight
    case BottomLeft
}

You can update text color, font and background color

triLabelView.textColor = UIColor.yellowColor()

triLabelView.labelFont = UIFont.systemFont(ofSize: 15)

triLabelView.viewColor = UIColor.brownColor()

Creating a view from the storyboard

<img src='https://raw.githubusercontent.com/mukeshthawani/TriLabelView/master/graphics/add_to_storyboard.png' width='260' alt='Add TriLabelView to storyboard'>

<img src='https://raw.githubusercontent.com/mukeshthawani/TriLabelView/master/graphics/attributes_inspector.png' width='360' alt='Attributes inspector'>

Requirements

Author

Mukesh Thawani

Contributing

Feature requests, bug reports, and pull requests are all welcome.

License

Copyright (c) 2016 Mukesh Thawani. Release under the MIT License.