let chipView = MDCChipView()
chipView.titleLabel.text = "Furkan@vijapura.com"
chipView.setTitleColor(UIColor.red, for: .selected)
chipView.sizeToFit()
chipView.backgroundColor(for: .selected)
self.view.addSubview(chipView)
self.userAdd.addSubview(chipView)
答案 0 :(得分:-1)
假设您已通过Pod安装:
带有浮动占位符的文本字段
let textFieldFloating = MDCMultilineTextField()
scrollView.addSubview(textFieldFloating)
textFieldFloating.placeholder = "Full Name"
textFieldFloating.textView.delegate = self
textFieldControllerFloating = MDCTextInputControllerUnderline(textInput: textFieldFloating) // Hold on as a property
带有字符计数和行内占位符的文本字段
// First the text field component is setup just like a UITextField
let textFieldDefaultCharMax = MDCMultilineTextField()
scrollView.addSubview(textFieldDefaultCharMax)
textFieldDefaultCharMax.placeholder = "Enter up to 50 characters"
textFieldDefaultCharMax.textView.delegate = self
// Second the controller is created to manage the text field
textFieldControllerDefaultCharMax = MDCTextInputControllerUnderline(textInput: textFieldDefaultCharMax) // Hold on as a property
textFieldControllerDefaultCharMax.characterCountMax = 50
textFieldControllerDefaultCharMax.isFloatingEnabled = false
此外,如果您想遵循Git项目,请使用:https://github.com/Skyscanner/SkyFloatingLabelTextField
答案 1 :(得分:-1)
您可以通过创建具有多个单元格的collectionView来实现此目的,您可以定义每个单元格的布局,最后一个单元格将包含一个文本字段。
如果需要参考代码,请告诉我。