-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable send Button in custom ChatInputItem #38
Comments
Hi @ogezue , (1) "Send" button attached to text view. It is enabled when text view has some text inside it. If you want to be able to send something without having text in text view, then you can place controls inside you own inputView. If you want to enable button on your own then you can help use and suggest your solution. (2) When user press "Send" button ChatInputItem.handleInput() function will be called: // ChatInputBar.swift
func inputBarSendButtonPressed(inputBar: ChatInputBar) {
if let focusedItem = self.focusedItem {
focusedItem.handleInput(inputBar.inputText)
} else if let keyboardItem = self.firstKeyboardInputItem() {
keyboardItem.handleInput(inputBar.inputText)
}
} You can do whatever you want in your own ChatInputItem protocol implementation: extension AppointmentInputItem : ChatInputItemProtocol {
...
public func handleInput(input: AnyObject) {
// do your staff here, "input" object will be text from text view
}
} Remember, that you have total control over your code in inputView object. For example, PhotoInputitem sends image without interacting with ChatInputItem protocol (3) We can't do anything with it. iOS responsible for resigning first responder when UIAlertView appears, but it should return first responder when UIAlertView disappears. I didn't check it, but with UIActionSheet it works well. |
Hi @AntonPalich, thank you very much for your answer. Perhaps you can give me some advice how to implement my InputItem if I show you a screenshot. The problem I'm currently focussing is to enable the send button without a textfield. |
Any suggestion? |
I have created my own ChatInputItem where the user can specify a date and a location. After the data has been entered the send button should get active so that I can call my REST-service to create an appointment request.
To achive this I think I need two modifications from you:
Here my AppointmentInputItem:
Another problem that I discovered is that the AppointmentInputItem loses its focus if I launch an UIAlertController to ask for another location. It would be great if this could be prevented too.
The text was updated successfully, but these errors were encountered: