Skip to content
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

Input Bar appear automatic when dismissal image #64

Closed
hhoangna opened this issue Jun 12, 2019 · 8 comments
Closed

Input Bar appear automatic when dismissal image #64

hhoangna opened this issue Jun 12, 2019 · 8 comments

Comments

@hhoangna
Copy link

Sorry I not good at English
In Chat view controller, I present a ImageView that has dismissal.
When i just try dismiss and release, not dismiss completion. inputbar automatic appear.
Please help me to prevent inputbar appear
ezgif com-optimize

@nathantannar4
Copy link
Owner

It looks like an error in your view controller transition. Your image preview controller is dismissed and then your messages controller becomes the first responder so the input bar appears. You should only dismiss the image preview controller when the drag gesture on the image ends

Sent with GitHawk

@hhoangna
Copy link
Author

How can I do like Messenger App? In Messenger, when I pan gesture on images, i still see input bar behind preview controller.

@nathantannar4
Copy link
Owner

Hmm, maybe try playing with the presentation style of the view controller to be .overCurrentContext?

Or, rather than presenting a new controller just add the image as a subview.

Sent with GitHawk

@hhoangna
Copy link
Author

Thanks a lot. I had found a solution. It is a trick :)

@nathantannar4
Copy link
Owner

@hhoangna what did you find worked for you?

Sent with GitHawk

@hassan31
Copy link

Hi, @hhoangna I just saw that you have added Emoji button inside the InputTextView, can you please let me know how can I add this to the InputBarView?

Thanks

@hhoangna
Copy link
Author

@hassan31 I just calculate and constraint.

Try this

private func setupLeftInputBarItem() {
        setLeftStackViewWidthConstant(to: 40, animated: false)
        middleContentViewPadding.left = -34
        btEmotion = makeButton(named: "ic_sticker_gray", onSelected: "ic_sticker_colored", size: CGSize(width: 40, height: 40))
        btEmotion.contentEdgeInsets = UIEdgeInsets(top: 6, left: 16, bottom: 10, right: 0)
        btEmotion.tag = 21
        setStackViewItems([btEmotion], forStack: .left , animated: false)
        
        invalidateIntrinsicContentSize()
    }

private func makeButton(named: String, onSelected nameSelect:String, size: CGSize) -> InputBarButtonItem {
        return InputBarButtonItem()
            .configure {
                $0.spacing = .fixed(10)
                $0.setSize(size, animated: false)
                $0.image = UIImage(named: named)?.withRenderingMode(.alwaysOriginal)
                $0.tintColor = UIColor(white: 0.8, alpha: 1)
            }.onSelected {
                $0.tintColor = .vinTextColor
                $0.image = UIImage(named: nameSelect)?.withRenderingMode(.alwaysOriginal)
            }.onTouchUpInside { item in
                //print("Item Tapped: \(item.tag)")
                if(item.tag == 21){
                    self.keyboardType = self.keyboardType == .emoji ? .text : .emoji
                    self.showKeyBoard(type: self.keyboardType, animated: true)
                }
            }
    }

@hassan31
Copy link

@hhoangna Awesome, thanks alot, it works. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants