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

MessageViewController not centered in container

unoiatech opened this issue · comments

I have a parentView and three childViewControllers (One of them is messageViewController) . On parentViewController , the messageViewController is selected by default.

Now, When i push to parentViewController, the messageViewController is not centred and inputToolBar is also hidden.
Here is my code on parentViewController :

// Code in ViewDidLoad
UIViewController *vc = [self viewControllerForSegmentIndex:self.segmentView.indexOfSelectedSegment];
    [self addChildViewController:vc];
    [vc didMoveToParentViewController:self];
    
    self.contentView.bounds =  vc.view.frame;
    [self.contentView addSubview:vc.view];
    self.currentViewController = vc;

// Method to assign viewControllers
- (UIViewController *)viewControllerForSegmentIndex:(NSInteger)index {
    UIViewController *vc;
    switch (index) {
        case 0:
            if (GLB.isBuyer)
            {
                // some viewController
            }
            else
            {
                // some viewController
            }

            break;
        case 1:
                // some viewController
            break;
        case 2:
            vc = [BSMainChatViewController messagesViewController];
            break;
    }
    return vc;
}

And this is how it looks like:
img_0817

You can see that viewController is in centre and inputBar is hidden.

Please help on this.

@unoiatech, it looks like you are changing the bounds rather the the frame. Another cause would be mixing AutoLayout and manual positioning.

Hope this info helps. 😃

Hello everyone!

I'm sorry to inform the community that I'm officially deprecating this project. 😢 Please read my blog post for details:

http://www.jessesquires.com/blog/officially-deprecating-jsqmessagesviewcontroller/

Thus, I'm closing all issues and pull requests and making the necessary updates to formally deprecate the library. I'm sorry if this is unexpected or disappointing. Please know that this was an extremely difficult decision to make. I'd like to thank everyone here for contributing and making this project so great. It was a fun 4 years. 😊

Thanks for understanding,
— jsq