Skip to content

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

License

Notifications You must be signed in to change notification settings

fengdianxun/TriLabelView

 
 

Repository files navigation

TriLabelView

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

  • This view is a subclass of UIView.
  • It can be created and customized from the Storyboard or from the code.


TriLabelView 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'

##Usage

Creating a view from the code

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

Customization

// Change Text
triLabelView.text = "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 size and background color

triLabelView.textColor = UIColor.yellowColor()

triLabelView.fontSize = 15

triLabelView.viewColor = UIColor.brownColor()

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 87.0%
  • Ruby 9.4%
  • Objective-C 3.6%