Messagekit: MessageInputBar Absent

Created on 31 Jan 2018  路  4Comments  路  Source: MessageKit/MessageKit

Hi,

Thanks a lot for your work !
i'm building a tabbed app, which have a message tab.

class TodoViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        let childVC = MessagesTodoViewController()
        addChildViewController(childVC)
        self.view.addSubview(childVC.view)
        childVC.didMove(toParentViewController:self)
        self.becomeFirstResponder()
    }
}

My MessagesTodoViewController follow your quickstart guide.
The MessageInputBar doesn't appear.

Is it the good place to put this code, or am i supposed to put it in the tab bar controller ?

thanks,
nelson

Most helpful comment

After googling, i find that i need to modify my MessagesTodoViewController :

class MessagesTodoViewController: MessagesViewController {
    override func viewDidAppear(_ animated: Bool) {
        self.becomeFirstResponder()
    }

All 4 comments

After googling, i find that i need to modify my MessagesTodoViewController :

class MessagesTodoViewController: MessagesViewController {
    override func viewDidAppear(_ animated: Bool) {
        self.becomeFirstResponder()
    }

Question, how did you get the inputaccessory view on top of the tabBar? Currently it is right above the tabbaritems, and when I change viewcontrollers, the inputaccessory disappears.

@arvidurs The MessageInputBar is only part of MessageViewController. You can add one to any view controller you like by overriding the inputAccessoryView and returning one. You also need to call becomeFirstResponder() on the controller.

Sent with GitHawk

i fix this porblem like this :

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    IQKeyboardManager.shared.enable = false
    self.becomeFirstResponder()
}

override func viewWillDisappear(_ animated: Bool) {
    IQKeyboardManager.shared.enable = true
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmedwasil picture ahmedwasil  路  3Comments

ChandraPrakashJangid picture ChandraPrakashJangid  路  3Comments

mlequeux picture mlequeux  路  3Comments

pawankmrai picture pawankmrai  路  3Comments

NiklasWilson picture NiklasWilson  路  4Comments