jessesquires / JSQMessagesViewController

An elegant messages UI library for iOS

Home Page:https://www.jessesquires.com/blog/officially-deprecating-jsqmessagesviewcontroller/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem hiding input toolbar while showing navigator controller's toolbar

Adelman-IsItYou opened this issue · comments

Hello.

I am working on a chat program using JSQMessagesViewController, and at the moment I am trying to implement an "edit" mode in which the user can delete individual messages. I have made JSQMessagesViewController's accessory button on top be an "Edit" or "Done" button, depending on whether the relevant view controller is in editing mode or not. I have successfully gotten the keyboard to hide in editing mode. I have gotten the navigation controller's toolbar on the bottom to show in editing mode (so I have a place to put a "delete" button). And when I hide JSQMessagesViewController's input toolbar, there is always a black bar just above the navigation controller's toolbar.

img_1338

The commands I am using to perform the changes in the UI for editing mode are:

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(handleDoneBarButtonItem:)];
    
    if ([self.inputToolbar.contentView.textView isFirstResponder]) {
        [self.inputToolbar.contentView.textView resignFirstResponder];
    }
    
    self.inputToolbar.hidden = YES;
    
    self.navigationController.toolbarHidden = NO;

However, variants on this still result in the black bar. What is this black bar, and how do I get rid of it?

Thanks in advance for any help anyone can provide.

According to the view hierarchy debugger, the black bar is a UIViewControllerWrapperView. Still no idea why I'm seeing it.

This is even weirder than I thought. Apparently the UIViewControllerWrapperView is due to a gap between the JSMessagesCollectionView and the UIToolbar.

Problem solved! I had my code save a copy of the collection view's frame and then reapply it after showing the navigation controller's toolbar.

@Adelman-IsItYou Thanks for confirming.