Latest 0.1.4
Homepage https://github.com/gyratorycircus/GYREdgeJustifiedLabel
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

EdgeJustifiedLabel is a UILabel subclass which allows two strings to be shown left and right justified on a single line, and equally scaled or truncated to fit the label bounds.

This capability is not possible using two separate UILabels and autolayout, as one will always scale before the other, nor is it possible via NSAttributedString, which does not allow left and right justified text to be displayed on a single line.

Additional options include minimum spacing between the strings, and truncation styles for each string once scaling options have been exhausted.

EdgeJustifiedLabel is also interoperable with Objective-C, and can be fully configured and previewed in Interface Builder.

Example

Example Screenshot

To run this example project for yourself, clone the repo, and run pod install from the Example directory first.

Usage

    var label = EdgeJustifiedLabel()
    label.leftText = "Left justified text"
    label.rightText = "Right justified text"
    label.minimumSpacing = 40
    label.truncationStyle = .rightTail

Requirements

Compatible with Swift 3.2 or 4.0.
When installing with cocoapods, iOS 8 or later is required, though the source file itself will compile for iOS 7.

Installation

GYREdgeJustifiedLabel is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'GYREdgeJustifiedLabel'

Author

Tom Jendrzejek ([email protected])

License

GYREdgeJustifiedLabel is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "GYREdgeJustifiedLabel",
    "version": "0.1.4",
    "summary": "A subclass of UILabel allowing for left and right justified text on a single line.",
    "description": "EdgeJustifiedLabel is a UILabel subclass which allows two strings to be shown left and right justified on a single line, and equally scaled or truncated to fit the label bounds.nThis capability is not possible using two separate UILabels and autolayout, as one will always scale before the other, nor is it possible via NSAttributedString, which does not allow left and right justified text to be displayed on a single line.nAdditional options include minimum spacing between the strings, and truncation styles for each string once scaling options have been exhausted.",
    "homepage": "https://github.com/gyratorycircus/GYREdgeJustifiedLabel",
    "screenshots": "https://raw.githubusercontent.com/gyratorycircus/GYREdgeJustifiedLabel/master/screenshot.png",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "gyratorycircus": "[email protected]"
    },
    "source": {
        "git": "https://github.com/gyratorycircus/GYREdgeJustifiedLabel.git",
        "tag": "0.1.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "GYREdgeJustifiedLabel/**/*.swift"
}

Pin It on Pinterest

Share This