4

Like this imageI have needed this type of chips UITextfield with a cancel button

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)
Cœur
  • 37,241
  • 25
  • 195
  • 267
Furkan
  • 306
  • 4
  • 17

2 Answers2

1

You can achieve this by creating a collectionView with multiple cells you can define the layout of each cell and your last cell will contain a text field.

Please let me know if you need a reference code for doing this.

Let's_Create
  • 2,963
  • 3
  • 14
  • 33
-1

Supposing that you have installed via pods:

Text Field with Floating Placeholder

let textFieldFloating = MDCMultilineTextField()
scrollView.addSubview(textFieldFloating)

textFieldFloating.placeholder = "Full Name"
textFieldFloating.textView.delegate = self

textFieldControllerFloating = MDCTextInputControllerUnderline(textInput: textFieldFloating) // Hold on as a property

Text Field with Character Count and Inline Placeholder

// 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

Also If you want to follow a Git Project Use: https://github.com/Skyscanner/SkyFloatingLabelTextField

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nishant Pathania
  • 349
  • 1
  • 14