DNMeterialTextField 0.0.1

DNMeterialTextField 0.0.1

Dhiru 维护。




DNMeterialTextField

Version License Platform

DNMeterialTextFiled

此 TextFiled 使用 Swift 语言创建,可用于 iOS,灵感来自 Material Design,Android EditText com.google.android.material.textfield.TextInputEditText

带图标

不带图标

示例

要运行示例项目,请先克隆代码库,然后从 Example 目录中运行 pod install

需求

平台: iOS , Swift 4.3+

安装

DNMeterialTextField 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'DNMeterialTextField'

使用

  1. DNMeterialTextField 将此文件连接到 Storyboard 中的 TextField。

  2. 代码使用

let textField = DNMeterialTextField(frame: CGRect(x: 0, y: 0, width: 200.00, height: 40.00)) textField.borderStyle = .none //重要 textField.placeholder = "Enter Email" self.view.addSubview(textField)

自定义

Storyboards 中的可检属性

边框样式必须设置为 none(如图中第四个选项)

使用代码进行修改

  1. 改变圆角 self.textField.cornerRadius = 10.0

  2. 改变激活颜色 self.textField.activeBorderColor = UIKit orange

  3. 改变非激活颜色 self.textField.inactiveColor = .darkGray

  4. 改变左侧图标(设置为nil移除图标,默认为nil) self.textField.leftSideIcon = UIImage(named:”ic_user”)

作者

Dhiru-Dev,[email protected]

StackOvrflow

许可证

DNMeterialTextField 在MIT许可证下可用。更多详情请参阅LICENSE文件。