ContactImageView 0.3.0

ContactImageView 0.3.0

George KyeGeorge Kye 维护。



codebeat badge

ContactImageView


UIImageView的子类,用文本作为ImageView的占位符,支持IBDesignable和代码。

安装

CocoaPods

pod 'ContactImageView'

手动

ContactImageView.swift文件拖拽到您的项目中

用法

故事板 / IBDesignable

IBDesignable screenshot

编程 / 代码

选项 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

选项 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

作者

乔治·凯

许可

ContactImageView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。