Skip to content

ridvank/UIImageViewWithWords

Repository files navigation

UIImageViewWithWords

[![CI Status](http://img.shields.io/travis/Ridvan Kucuk/UIImageViewWithWords.svg?style=flat)](https://travis-ci.org/Ridvan Kucuk/UIImageViewWithWords) Version License Platform

UIImageViewWithWords

UIImageView extension that helps you to create images with initial letters of words.

Installation

From CocoaPods

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

For Swift 3.x:

pod "UIImageViewWithWords"

For Swift 2.3:

pod "UIImageViewWithWords", '~> 0.2.2'

For Swift 2.2:

pod "UIImageViewWithWords", '~> 0.2.1'

Usage

UIImageViewWithWords is written in Swift and it gives you the ability to create images from word's initials.

This will add an image with initials to your UIImageView object with random background color with circular shaped.

imageView.image(with: "Ridvan Kucuk")

or if you want to add attributes to text, you can set attributes like this for Swift 3.x:

let fontAttributes = [NSForegroundColorAttributeName : UIColor.blue,
                                 NSFontAttributeName : UIFont.systemFont(ofSize: 40)]
self.imageView.image(with: "Ridvan Kucuk", color: UIColor.orange, circular: true, fontAttributes: fontAttributes)

for Swift 2.x:

let fontAttributes = [NSForegroundColorAttributeName : UIColor.blueColor(),
NSFontAttributeName : UIFont.systemFontOfSize(40)
]
self.imageView.image(with: "Ridvan Kucuk", color: UIColor.orangeColor(), circular: true, fontAttributes: fontAttributes)

Manually

You can just drag and drop UIImageView+Words.swift file into your project.

Author

Ridvan Kucuk, [email protected]

License

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