Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

badoo/HyperLabel

Repository files navigation

HyperLabel is a UILabel replacement which suports adding links for arbitraray part of the text

Features

UI Automation support

HyperLabel supports setting customaccessibilityIdentifier for added links

VoiceOver

All added links will have proper description and will be accessible with VoiceOver

No subclassing needed

If you already have a subclass of UILabel, you can add HyperLabel functionallity to it. Just by conform it toHyperLabelProtocol and callinitializeHyperLabel

Usage

letlabel=HLHyperLabel()// Set additional attributes which will be applied for added linkslabel.additionalLinkAttributes=[NSAttributedString.Key.foregroundColor:UIColor.red,NSAttributedString.Key.underlineStyle:NSUnderlineStyle.single.rawValue]// Set textlabel.text="Hello world!"// Get range of the linkletlinkRange=(textasNSString).range(of:"world")// Add handler for rangelabel.addLink(withRange: linkRange){    // On link press}

Installation

Carthage

Add HyperLabel to your Cartfile:

github "badoo/HyperLabel"

Manual

  1. Add as a submodule ordownload
  2. DragHyperLabel.xcodeproj inside of your project
  3. AddHyperLabel.framework to Target Dependencies
  4. AddHyperLabel.framework to Embedded Binaries

License

Source code is distributed under MIT license


[8]ページ先頭

©2009-2025 Movatter.jp