user3282227
user3282227

Reputation: 149

UITextField inside UITableviewcell. editable but keyboard is not showing

not an iOS expert here. using xcode 11 and latest iOS and objective C. i want user to be able to add some text. textfield is editable but i don't see the keyboard. if i click on next cell, i get constraints warning in console. there are quite a few SO questions on this topic. but nothing is helping. textFieldShouldBeginEditing() does get called and i'm returning YES.

2020-09-13 12:47:18.294987-0700 EWF[31667:891775] -[ewfSubMenuViewController textFieldShouldBeginEditing:] tag 12377 2
2020-09-13 12:47:23.760577-0700 EWF[31667:891775] last selected 0
2020-09-13 12:47:23.760831-0700 EWF[31667:891775] -[ewfSubMenuViewController tableView:didSelectRowAtIndexPath:]: index 1 mainmenu 0
2020-09-13 12:47:25.898776-0700 EWF[31667:891775] -[ewfSubMenuViewController textFieldShouldBeginEditing:] tag 12378 1
2020-09-13 12:47:25.914790-0700 EWF[31667:891775] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x60000399aa80 'assistantHeight' TUISystemInputAssistantView:0x7fcf4d64d6f0.height == 38   (active)>",
    "<NSLayoutConstraint:0x6000039e94f0 'assistantView.bottom' TUISystemInputAssistantView:0x7fcf4d64d6f0.bottom == _UIKBCompatInputView:0x7fcf4d744070.top   (active)>",
    "<NSLayoutConstraint:0x6000039e9400 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x7fcf4d64d6f0]   (active, names: '|':UIInputSetHostView:0x7fcf4fb23800 )>",
    "<NSLayoutConstraint:0x6000039f9b80 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x7fcf4d744070]   (active, names: '|':UIInputSetHostView:0x7fcf4fb23800 )>"
)

tried all of this:

 cell.tfItemNote.delegate = self;
    //cell.tfItemNote.clearButtonMode = UITextFieldViewModeNever;
    //[cell.contentView addSubview:cell.tfItemNote];
    //cell.accessoryType = UITableViewCellAccessoryNone;
    //[cell.tfItemNote becomeFirstResponder];
    
    tableView.userInteractionEnabled = YES;
    cell.tfItemNote.userInteractionEnabled = YES;
    
    //tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
    //tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
    //cell.tfItemNote.returnKeyType = UIReturnKeyDone;

i'd like keyboard to be dismissed when user clicks return.

appreciate any help. thank you.

enter image description here

Upvotes: 0

Views: 213

Answers (1)

Vincent Sit
Vincent Sit

Reputation: 2344

You can use the shortcut Command+K to toggle the keyboard when running in simulator.

This is the behavior of the simulator, you will not have this problem with a real device.

enter image description here

Upvotes: 1

Related Questions