OrangeLabel
OrangeLabel is extensions of UILabel linkable, available line background and placeholder text
Install / Use
/learn @pisces/OrangeLabelREADME
OrangeLabel
- OrangeLabel is extensions of UILabel linkable, available line background and placeholder text
Features
- Link for mention, hashtag, url and custom
- Placeholder text and color
- Line background
Import
import OrangeLabel
Example
<img src="Screenshot/ss_01.png" width="375" />let numbers = UILabelLinkType.custom(pattern: "[0-9]+")
let label = OrangeLabel()
label.adjustsFontSizeToFitWidth = true
label.enabledLinkTypes = [.mention, .hashtag, .url, numbers]
label.isUserInteractionEnabled = true
label.font = UIFont(name: "AvenirNext-Bold", size: 60)
label.minimumScaleFactor = 0.2
label.lineBackgroundColor = .black
label.lineBackgroundInset = UIEdgeInsets(top: -5, left: 5, bottom: -5, right: 5)
label.numberOfLines = 0
label.text = "@steve Your selfie overed 1000 views @steve Your selfie overed 1000 views @steve Your selfie overed 1000 views @steve #hahaha http://retrica.co Your selfie overed 1000 views @steve Your selfie overed 1000 views @steve Your selfie overed 1000 views www.retrica.co @steve Your selfie overed 1000 views @steve Your selfie overed 1000 views @steve #hahaha Your selfie overed 1000 views @steve Your selfie overed 1000 views"
label.textAlignment = .center
label.textColor = .white
label.setHighlightedLinkColor(UIColor.white.withAlphaComponent(0.5), type: .mention)
.setHighlightedLinkColor(UIColor.white.withAlphaComponent(0.5), type: .hashtag)
.setHighlightedLinkColor(UIColor.white.withAlphaComponent(0.5), type: .url)
.setHighlightedLinkColor(UIColor.white.withAlphaComponent(0.5), type: numbers)
.setAttributes([NSUnderlineStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue,
NSForegroundColorAttributeName: UIColor(red: 1, green: 185/255, blue: 0, alpha: 1)], type: .mention)
.setAttributes([NSForegroundColorAttributeName: UIColor(red: 225/255, green: 66/255, blue: 16/255, alpha: 1)], type: .hashtag)
.setAttributes([NSForegroundColorAttributeName: UIColor(red: 0, green: 204/255, blue: 238/255, alpha: 1)], type: .url)
.setAttributes([NSForegroundColorAttributeName: UIColor(red: 1, green: 85/255, blue: 0, alpha: 1)], type: numbers)
label.linkTapped { (link) in
print(link)
}
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1.0+ is required to build OrangeLabel 0.1.0+.
To integrate OrangeLabel into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target '<Your Target Name>' do
pod 'OrangeLabel', '~> 0.2.0'
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 Alamofire into your Xcode project using Carthage, specify it in your Cartfile:
github "pisces/OrangeLabel" ~> 0.2.0
Run carthage update to build the framework and drag the built OrangeLabel.framework into your Xcode project.
Requirements
iOS Deployment Target 9.0 higher
Author
Steve Kim, hh963103@gmail.com
License
OrangeLabel is available under the MIT license. See the LICENSE file for more info.
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
