MessageKit Version: 0.10.0
iOS Version(s): iOS 10.3
Swift Version: Swift 4
Devices/Simulators: Device
Reproducible in ChatExample? (Yes/No): Yes
When I try to add ConversationViewController as a child view controller on InboxViewController that time messageInputBar does not display on the view.
Below code
let contentVC:UIViewController = ConversationViewController()
addChildViewController(contentVC)
self.view.addSubview(contentVC.view)
contentVC.didMove(toParentViewController: self)
The messageInputBar must display on the view even though I add ConversationViewController as a child view.
@nfasate I think you have to call:
messagesViewController.becomeFirstReponder()
cc @cwalo I think he had a solution for this
Hi SD10,
Thanks for quick reply, but I don't get it from where I have to call messagesViewController.becomeFirstReponder() in my code.
I guess the size of messageInputBar is always return zero when I have added ConversationViewController as a child view.
Thanks.
@nfasate try calling messagesViewController.becomeFirstReponder() in viewDidAppear
@Wotafak,
I am not able to call messagesViewController.becomeFirstReponder() in ViewDidAppear it throw compilor errorUse of unresolved identifier 'messagesViewController'
@nfasate It looks like your MessagesViewController is called contentVC.
@SD10 Even after using contentVC.becomeFirstResponder(), the MessageViewController doesn't show messageInputBar.
@SD10 Thanks a ton !! it worked.
Hey @nfasate - can you share how you solved the problem in the end?
Hi @BasThomas
I just added self.becomeFirstResponder() in ConversationViewController ViewDidAppear as per sugested by @Wotafak and @SD10 .
My scenario sounds slightly different as I have two view controllers added as children - one being the MessagesViewController. I'm just toggling their hidden state depending on which is selected. But yeah, to handle the input bar, I call becomeFirstResponder and when I want it go away, I callinputBar.inputTextView.resignFirstResponder and messagesViewController.resignFirstResponder.
Most helpful comment
Hi @BasThomas
I just added
self.becomeFirstResponder()in ConversationViewControllerViewDidAppearas per sugested by @Wotafak and @SD10 .