Error When Adding Input View to Textfield iOS 8

Error when adding input view to textfield iOS 8

I encountered this problem before.

Problem:

  • You have to ensure that the view you will assign to inputView or inputAccessoryView doesn't belong to any parent view. When you create these views from a xib inside a ViewController, by default they are set as subviews of a superview.

Solution Tips:

  • Use the method removeFromSuperview on the view you will assign to inputView or inputAccessoryView

Adding a UIDatePicker as an inputView to a textField in iOS 8

After receiving an email from Apple's Developer Technical Support, it seems that to add a UIDatePicker (or any custom keyboard for what I've understood) to a viewController, you don't have to add it to its view anymore, but you add it to its title bar and then connect it to the IBOutlet.

It's working for me, even if it doesn't work in the iPhone 5 simulator (all the others are ok) and I was going nuts.

I hope this could be of help for other people with the same problem.

InputView not working in TextFields inside UICollectionView

Instead of creating an outlet of UIPickerView and assigning it to the pickerView to show as inputView just try the code below.

    UIPickerView *pikerView = [[UIPickerView alloc]init];

pikerView.delegate =self;
pikerView.dataSource = self;

cell.cropPercent.textColor = [UIColor redColor];

cell.cropPercent.inputView = pikerView;

UITextField inputView is not working in Swift

I was really surprised when saw such a bug! You code looks 100% valid and must work. I even created small project to reproduce the problem. And succeeded with reproduction.

So my steps were:

  1. Creare simple project with UITextView in Xib that gets instantiated in application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!). Run and see that default keyboard gets displayed.

  2. Add two more views to the Xib and connect them to MyViewController. And set inputView and accessoryInputView in viewDidLoad as you did.

  3. Run and see the problem.

Answer starts here:

Then I've just reset emulator, cleaned the build folder and run the code again. And it worked as expected!

It looks for me like a bug with either xCode or emulator(or may be both) but I cannot say who is guilty an why.

Screenshot (view with buttons is my keyboard :)

Sample Image

Input View Not Changing For UITextField

Try

func wieghtResponse(){
userInput.inputView = nil // reset your input view for weight input
userInput.keyboardType = UIKeyboardType.numberPad
userInput.becomeFirstResponder()
}

iPhone UITextField inputView error: Assignement to readonly property

You are setting the input view of UILabel.
You declared baseLabel as UILabel not UITextField.

IBOutlet UILabel *baseLabel;

UITextField.inputView suddenly not popping up UIPickerView after working for days

Instead of deleting I thought I'd answer in hopes it will help others.

I had to change the hardware settings in the simulator. I don't know why but the simulator seems to be bugged.

Unchecking Hardware => Keyboard => Connect Hardware Keyboard in the simulator fixed the problem.

Setting UITextField's inputView property to a UIPicker not working in Swift

The issue in your current code is in this method:

func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
itemPicker.hidden = false
return false // <--- this is not letting the textField become editable
}

I would suggest removing this method entirely.



Related Topics



Leave a reply



Submit