This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
How can i set input view to AnimatedTextInput ? I want to add picker view as input view to it. #39
Labels
Comments
@mukulm24 did you manage to do this? |
@victorBaro Any clue for me being able to set inputView in AnimatedTextInput? Like UIPickerView or UIDatePicker |
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 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)
}
} |
Closed
@mukulm24 @cesarmtz93 @jorgerebolloj |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
inputView is get-only property.
The text was updated successfully, but these errors were encountered: