UIImageView subclass which generates text as the placeholder for an ImageView, supports IBDesignable
and code.
pod 'ContactImageView'
Drag ContactImageView.swift
file to your project
IBDesignable
Option 1
let imageView = ContactImageView(frame: CGRect(x:10, y: 50, width: 100, height: 100))
imageView.setImageText(text: "George Kye", backgroundImage: UIImage(named: "bg"), username: true, textColor: UIColor.whiteColor(), fillColor: UIColor.blackColor(), circle: true) //backgroundImage is optional
Option 2
let imageView2 = ContactImageView(frame: CGRect(x:130, y: 50, width: 100, height: 100))
imageView2.text = "Joe Swanson" //Default = "GK"
imageView2.username = true //Default = false (Returns initials of username if true)
imageView2.textColor = UIColor.purpleColor() //Default = UIColor.whiteColor()
imageView2.circle = false //Default = true
imageView2.textFont = UIFont.italicSystemFontOfSize(30) //Default = UIFont.systemFontOfSize(22)
imageView2.fontSize = 11 //Default = 22
imageView2.fillColor = UIColor.greenColor() //Default = UIColor.lightGrayColor
George Kye
ContactImageView is available under the MIT license. See the LICENSE file for more info.