All Projects → darincon → MaskedLabel

darincon / MaskedLabel

Licence: MIT license
MaskedLabel is a UILabel subclass that allows you to easily apply a gradient to its text or to make it transparent.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to MaskedLabel

Rhplaceholder
Show pleasant loading view for your users 😍
Stars: ✭ 238 (+1090%)
Mutual labels:  ios-ui, gradient
ios-font-size-tester
A quick way to test out a resizable iOS app font stack at all sizes via UI testing
Stars: ✭ 43 (+115%)
Mutual labels:  ios-ui
Mentornet
Code for MentorNet: Learning Data-Driven Curriculum for Very Deep Neural Networks
Stars: ✭ 245 (+1125%)
Mutual labels:  label
conic.css
nice'n simple conic gradients 🎨
Stars: ✭ 195 (+875%)
Mutual labels:  gradient
css-studies
🎨 Aplicação com interface baseada em Neumorphism + Geração de códigos CSS para Gradientes e Bordas + Visualização instantânea.
Stars: ✭ 33 (+65%)
Mutual labels:  gradient
hash-avatar
🌈 Hash avatar algorithm
Stars: ✭ 33 (+65%)
Mutual labels:  gradient
Vue Float Label
Float label pattern
Stars: ✭ 177 (+785%)
Mutual labels:  label
gradient-cli
The command line interface for Gradient - https://gradient.paperspace.com
Stars: ✭ 58 (+190%)
Mutual labels:  gradient
gradient-badge
🍭 Badge generator with color gradient support
Stars: ✭ 47 (+135%)
Mutual labels:  gradient
UIGradientSlider
GradientSlider is a UIControl subclass which is similar to UISlider, but with a linear gradient coloring the slider’s track. Useful for creating color pickers. Initially fork of https://github.com/jonhull/GradientSlider rewritten to Obj-C
Stars: ✭ 28 (+40%)
Mutual labels:  gradient
Rainblur-Landing-Page
Tailwind CSS Starter Template - Rainblur Landing Page (dark)
Stars: ✭ 112 (+460%)
Mutual labels:  gradient
Weather-SwiftUI
A weather app that uses the Dark Sky API built using SwiftUI! Get the current weather for a particular location and check out the 5-day forecast!
Stars: ✭ 107 (+435%)
Mutual labels:  gradient
less-mix
LESS-Mix - is a functional, powerful and convenient library LESS-mixins.
Stars: ✭ 22 (+10%)
Mutual labels:  gradient
Dwanimatedlabel
An UILabel subclass that lets you animate text with different types
Stars: ✭ 252 (+1160%)
Mutual labels:  label
olwind
Wind layers for OpenLayers
Stars: ✭ 22 (+10%)
Mutual labels:  gradient
Mpitextkit
Powerful text framework for iOS to display rich text based on TextKit, inspired by Texture and YYText.
Stars: ✭ 191 (+855%)
Mutual labels:  label
extensions-kit
📦 Collection of Swift+Apple Frameworks extensions for speeding up software development [iOS & iPadOS].
Stars: ✭ 71 (+255%)
Mutual labels:  ios-ui
auto-label
Auto Label Issue Based on Issue Description
Stars: ✭ 34 (+70%)
Mutual labels:  label
AttachmentInput
AttachmentInput is image picker keyboard.
Stars: ✭ 30 (+50%)
Mutual labels:  ios-ui
leaflet-labeled-circle
Special type of SVG marker with a label inside and draggable around the anchor point
Stars: ✭ 35 (+75%)
Mutual labels:  label

MaskedLabel

Language Platform CocoaPods compatible Carthage compatible License

Swift Version MaskedLabel View Version
3.1 0.9.0

MaskedLabel is a UILabel subclass that allows you to easily apply a gradient to its text or to make it transparent.

alt tag

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate MaskedLabel into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'MaskedLabel', '~> 0.9.2'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate MaskedLabel into your Xcode project using Carthage, specify it in your Cartfile:

github "darincon/MaskedLabel" ~> 0.9.2

Run carthage update to build the framework and drag the built MaskedLabel.framework into your Xcode project.

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate MaskedLabel into your project manually.

Usage

MaskedLabel can be used both programmatically and with storyboards.

Storyboards

Add a UILabel to your storyboard and change its class to MaskedLabel.

Programatically

  • Initialization without parameters
let maskedLabel = MaskedLabel()
  • Initialization with frame
let maskedLabel = MaskedLabel(frame: CGRect(x: 10, y: 50, width: 200, height: 100))

Setup

There are a few properties you can set to obtain the desired behavior:

  • gradientColors: An array of UIColor that defines the gradient. If it contains only one element, it will be applied as start and end color. In case this property is nil or an empty array, the value of fillColor will be used instead.
  • gradientLocations: The location for each color provided in components. Each location must be a CGFloat value in the range of 0 to 1, inclusive. If 0 and 1 are not in the locations array, Quartz uses the colors provided that are closest to 0 and 1 for those locations.
  • startPoint: The coordinate that defines the starting point of the gradient.
  • endPoint: The coordinate that defines the ending point of the gradient.
  • fillColor: Set this property when a constant color is needed instead of a gradient. If both this property and gradientColors are set, this color is omitted and the gradient will be applied to the text. The default color is black.
  • fillOption: A constant indicating if the gradient, or color, will be applied to the label's background, making the text transparent, or to the text.

Example

let maskedLabel = MaskedLabel()
maskedLabel.gradientColors = [UIColor.red, UIColor.blue]
maskedLabel.startPoint = CGPoint(x: 0.0, y: 0.0)
maskedLabel.endPoint = CGPoint(x: maskedLabel.frame.width, y: maskedLabel.frame.height)
maskedLabel.fillOption = .background
maskedLabel.text = "MaskedLabel"

License

ViewControllerStates is released under the MIT license. See license for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].