I have a UITextField which on its rightview has a button. The textfield's input view is a pickerView. Now, I have hidden the cursor of the textField following here:
Hide the cursor of an UITextField
When I select the textField, the pickerView comes up. The first value in the pickerView is +1
. Everything is alright till here.
Now, when I select +34
from the pickerView, the text in the textField shifts to left and half of the plus is not visible in the left. After this, even if I select +1
, half of the plus is hidden in the left. I suspect it has to do with the amount of text area in the textField is getting increased because of the increase in size of text. Not sure though.
Note that when the pickerView goes down, the text in TextField aligns itself correctly.
What should I do to make sure the text does not get shifted to the left the whole thing remains visible?
Thanks.
Picker code
self.picker = UIPickerView()
self.picker.delegate = delegate
self.picker.dataSource = delegate
self.picker.showsSelectionIndicator = true
self.countriesSpinner = createPickerTextField([
"width": width,
"height": height,
"top": top,
"left": left
]) //This returns a text field
self.countriesSpinner.inputView = self.picker