kmcgill88 / McPicker-iOS

McPicker is a customizable, closure driven UIPickerView drop-in solution with animations that is rotation ready.
MIT License
213 stars 43 forks source link

Is there a way to use McPicker with a TextField as InputView ? #22

Closed sundeepdev closed 6 years ago

sundeepdev commented 7 years ago

I want to use McPicker as an InputViews on my textfield. I don't have access to the PickerView

kmcgill88 commented 7 years ago

I am not following. Can you please elaborate your question with an example use case? Thanks!

sundeepdev commented 7 years ago

Sorry for the short description. Let me elaborate. So if you want to use a picker when a user tries to enter some data in textfield. You can set the UIPickerView as the inputview for the UITextField.

firstNameTextField.inputView = uiPickerView

What it does is that it shows the PickerView instead of the Keyboard when a user begins editing. The benefit is that it handles the showing and hiding of the pickerView using the normal textfield delegates. So the question is, if there's a way to do that using McPicker? I thought I can assign the internal UIPickerView of McPicker to the TextField but we don't have access to it directly.

kmcgill88 commented 7 years ago

Oh! I gotcha! Currently no, there is no access to the underlying UIPickerView so you wouldn't be able to do this. I haven't considered the use case but I think its a great one. Do you have any suggestions how to wire it up? Maybe add something like showAsInputView?

kmcgill88 commented 6 years ago

@sundeepdev I've added a solution in #34