Code Monkey home page Code Monkey logo

Comments (4)

victorBaro avatar victorBaro commented on July 21, 2024 3

As I mentioned here, I will add support for inputView and accessoryView. I will try to add it very soon.

Currently, you can override your ViewController's inputView and return your date picker, or you can create your own textView/textField, conform to TextInput protocol and pass your date picker.

Something like this:

// For a more in-depth example, take a look at `AnimatedTextView` or `AnimatedTextField`. These classes are now internal, but they will be public in the next release.
class MyTextView: UITextView, TextInput {

    var view: UIView {
        return self
    }

    var currentText: String? {
        get { return text }
        set { self.text = newValue }
    }

    var currentSelectedTextRange: UITextRange? {
        get { return self.selectedTextRange }
        set { self.selectedTextRange = newValue }
    }

    var textAttributes: [String: Any]? {
        didSet {
            guard let attributes = textAttributes else { return }
            typingAttributes = attributes
        }
    }

    weak var textInputDelegate: TextInputDelegate?

    var currentBeginningOfDocument: UITextPosition? {
        return self.beginningOfDocument
    }

    func changeReturnKeyType(with newReturnKeyType: UIReturnKeyType) {
        returnKeyType = newReturnKeyType
    }

    func currentPosition(from: UITextPosition, offset: Int) -> UITextPosition? {
        return position(from: from, offset: offset)
    }
}


class ViewController: UIViewController {

    @IBOutlet var textInput: AnimatedTextInput!

    override func viewDidLoad() {
        textInput.placeHolderText = "Date picker"
        let myTextInput = MyTextView()
        //Configure and assign your input view
        myTextInput.inputView = UIDatePicker()
        textInputs[2].type = .generic(textInput: myTextInput)
    }
}

from animatedtextinput.

cesarmtz93 avatar cesarmtz93 commented on July 21, 2024

@mukulm24 did you manage to do this?

from animatedtextinput.

jorgerebolloj avatar jorgerebolloj commented on July 21, 2024

@victorBaro Any clue for me being able to set inputView in AnimatedTextInput? Like UIPickerView or UIDatePicker

from animatedtextinput.

victorBaro avatar victorBaro commented on July 21, 2024

@mukulm24 @cesarmtz93 @jorgerebolloj
This PR has just been approved and merged in master. I will be generating a new version very soon with the new changes.

#49 (review)

from animatedtextinput.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.