{"action":"created","issue":{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/1135","labels_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/1135/labels{/name}","comments_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/1135/comments","events_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/1135/events","html_url":"https://github.com/jessesquires/JSQMessagesViewController/issues/1135","id":98685161,"number":1135,"title":"How to add UITapGestureRecognizer - Tapping outside does not dismiss keyboard","user":{"login":"hmaidasani","id":1074965,"avatar_url":"https://avatars.githubusercontent.com/u/1074965?v=3","gravatar_id":"","url":"https://api.github.com/users/hmaidasani","html_url":"https://github.com/hmaidasani","followers_url":"https://api.github.com/users/hmaidasani/followers","following_url":"https://api.github.com/users/hmaidasani/following{/other_user}","gists_url":"https://api.github.com/users/hmaidasani/gists{/gist_id}","starred_url":"https://api.github.com/users/hmaidasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmaidasani/subscriptions","organizations_url":"https://api.github.com/users/hmaidasani/orgs","repos_url":"https://api.github.com/users/hmaidasani/repos","events_url":"https://api.github.com/users/hmaidasani/events{/privacy}","received_events_url":"https://api.github.com/users/hmaidasani/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/labels/duplicate","name":"duplicate","color":"cccccc"},{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/labels/questions%20&%20help","name":"questions & help","color":"bfdadc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-03T07:06:39Z","updated_at":"2015-08-03T14:10:59Z","closed_at":"2015-08-03T14:10:59Z","body":"Hey @jessesquires, I'm having the same issue as @sahirc in #1076. The collectionView tap gestures don't get recognized everywhere. A simple tap outside the keyboard does not dismiss it. Below is the code which has been adapted from issue #360. Any suggestions?\r\n\r\n```\r\nimport UIKit\r\nimport Foundation\r\n\r\nclass ChatViewController: JSQMessagesViewController, UIGestureRecognizerDelegate {\r\n\r\n...\r\n...\r\n\r\n   override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        ...\r\n        addTapGestures()\r\n        ...\r\n   }\r\n\r\n   func gestureRecognizer(UIGestureRecognizer,\r\n        shouldRecognizeSimultaneouslyWithGestureRecognizer:UIGestureRecognizer) -> Bool {\r\n            return true\r\n   }\r\n\r\n   func addTapGestures() {\r\n        let gesture = UITapGestureRecognizer(target: self, action: Selector(\"tapAndHideKeyboard:\"))\r\n        self.collectionView.addGestureRecognizer(gesture)\r\n   }\r\n\r\n   func tapAndHideKeyboard(gesture: UITapGestureRecognizer) {\r\n        println(gesture)\r\n        if(gesture.state == UIGestureRecognizerState.Ended) {\r\n            if(self.inputToolbar.contentView.textView.isFirstResponder()) {\r\n                self.inputToolbar.contentView.textView.resignFirstResponder()\r\n            }\r\n        }\r\n   }\r\n\r\n...\r\n\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/comments/127255489","html_url":"https://github.com/jessesquires/JSQMessagesViewController/issues/1135#issuecomment-127255489","issue_url":"https://api.github.com/repos/jessesquires/JSQMessagesViewController/issues/1135","id":127255489,"user":{"login":"jessesquires","id":2301114,"avatar_url":"https://avatars.githubusercontent.com/u/2301114?v=3","gravatar_id":"","url":"https://api.github.com/users/jessesquires","html_url":"https://github.com/jessesquires","followers_url":"https://api.github.com/users/jessesquires/followers","following_url":"https://api.github.com/users/jessesquires/following{/other_user}","gists_url":"https://api.github.com/users/jessesquires/gists{/gist_id}","starred_url":"https://api.github.com/users/jessesquires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessesquires/subscriptions","organizations_url":"https://api.github.com/users/jessesquires/orgs","repos_url":"https://api.github.com/users/jessesquires/repos","events_url":"https://api.github.com/users/jessesquires/events{/privacy}","received_events_url":"https://api.github.com/users/jessesquires/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T14:10:59Z","updated_at":"2015-08-03T14:10:59Z","body":"Thanks @hmaidasani ! I'm going to close this as a duplicate of #1076. The issue may be closed, but the discussion can still continue there :smile: \r\n\r\n> P.S. Please review the [contribution guidelines](https://github.com/jessesquires/JSQMessagesViewController/blob/develop/CONTRIBUTING.md) before opening new issues! :smile: "}}