4

I have used Cocoapods to integrate MaterialsComponents with a new Xcode Project and entered Xcode via the Workspace. I then created a very basic interface with one UITextField added to the main.storyboard. I did a build without errors and the simple interface allows me to enter data into the UITextField.

So then, copying Google's code sample in their lesson MDC-111, I converted the UITextField to an MDCTextField to see if the special Material Design handling of a Text Field works (i.e. the placeholder text moves up as I enter text). I had no build errors and the project correctly built in the simulator but does not allow text entry. Clicking on the field does not bring up the keyboard and does not accept text. I have tried changing the "User Interaction Enabled" from On to Off and back to On with no effect.`This is my Swift View Controller code:

import UIKit
import MaterialComponents

class ViewController: UIViewController, UITextFieldDelegate {

    @IBOutlet weak var helloText: MDCTextField!

    // MARK: Properties
    var helloController: MDCTextInputControllerOutlined?

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        helloController = MDCTextInputControllerOutlined(textInput: helloText)

    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
Newbie
  • 51
  • 1
  • 3
  • I am closing this Question because kind folk on GitHub Materials Components site have solved it. For information, I had set a 'Height' constraint on the text field that was too small to allow the MDC behaviour to operate. Removing the constraint allowed the field to expand to full operational size. – Newbie Jun 01 '18 at 09:42

1 Answers1

0

I am closing this Question because kind folk on GitHub Materials Components site have solved it. For information, I had set a 'Height' constraint on the text field that was too small to allow the MDC behaviour to operate. Removing the constraint allowed the field to expand to full operational size.

Newbie
  • 51
  • 1
  • 3