Latest 1.0.0
Homepage https://github.com/PhilippOtto89/WordWrapLabel
License MIT
Platforms ios 8.0
Authors

Version
License: MIT
Platform

Example

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

Requirements

Installation

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

pod 'WordWrapLabel'

Description

A UILabel subclass that really makes sure that every word in the label´s text fits into one line.

The standard UILabel can automatically adjust the scale of the font size to make the whole text fit the label bounds but it doesn´t take into account the actual length of the different words of the given text. This results in words being broken up into multiple lines because they are too long to fit one line.

The WordWrapLabel finds the suitable font size to make every word of the given text fit into one line.

It also makes sure that the text fits into the whole bounds of the label when there is a line number or height restriction.

Usage

To use WordWrapLabel just import the module in your code.

import WordWrapLabel

Then use it as the custom UILabel subclass in interface builder or initialize it in code.

You can define a minimum and maximum font size which will be taken into account when determining the right font size for the label. The search will start at the maximumFontPointSize and then reduce the font size until either every word fits one line or minimumFontPointSize is reached.

maximumFontPointSize and minimumFontPointSize can be set in interface builder or in code.

wordWrapLabel.maximumFontPointSize = 25 // Default is 40
wordWrapLabel.minimumFontPointSize = 10 // Default is 1

Author

Philipp, [email protected]

License

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

Latest podspec

{
    "name": "WordWrapLabel",
    "version": "1.0.0",
    "summary": "A short description of WordWrapLabel.",
    "description": "A UILabel subclass that really makes sure that every word in the labels text fits into one line.",
    "homepage": "https://github.com/PhilippOtto89/WordWrapLabel",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Philipp": "[email protected]"
    },
    "source": {
        "git": "https://github.com/PhilippOtto89/WordWrapLabel.git",
        "tag": "1.0.0"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "WordWrapLabel/Classes/**/*"
}

Pin It on Pinterest

Share This