Hide input Toolbar in JSQMessagesViewController
I am using JSQMessagesViewController for my chat application. When there is no internet activity, I would like to hide the inputToolbar
I tried this but it doesn't work:
self.inputToolbar.frame.size = CGSize(width: 0,height: 0)
When I installed this, it was gone in less than a second:
self.inputToolbar.preferredDefaultHeight = 0
Any ideas how to do this? Perhaps disabling the Input Toolbar might also be good enough.
+3
source to share
3 answers
I have found the best solution that has no side effects.
You can make actions in the class a descendant of the JSQMessagesViewController class.
1. Make this base class method available to you:
@interface JSQMessagesViewController ()
- (void)jsq_setCollectionViewInsetsTopValue:(CGFloat)top
bottomValue:(CGFloat)bottom;
@end
2. override the parent implementation method (called resizing):
- (void)jsq_updateCollectionViewInsets {
CGFloat topInset = self.topLayoutGuide.length + self.topContentAdditionalInset;
CGFloat bottomInset = 0.0;
[self jsq_setCollectionViewInsetsTopValue:topInset bottomValue:bottomInset];
}
3. Make a note of how to hide the Input Toolbar permanently:
- (void)hideInputToolbar {
self.inputToolbar.hidden = YES;
[self jsq_updateCollectionViewInsets];
}
4. Enjoy!
+4
source to share