Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:38:13+00:00 2026-06-04T13:38:13+00:00

i am making a chat application, and in the chat window there are uilabels

  • 0

i am making a chat application, and in the chat window there are uilabels in uitableviewcells. initially the keyboard will be present but when the user touches on any place on uitableview, i will make the chat window as fullscreen (dissappearing keyboard).

i cant find a way/trick to accomplish this.

i have tried the following method: by using tableview:didselectrowatindexpath, i am able to do it but, user needs to press on an existent uitableviewcell. but i want to understand the press even when uitableview is empty..

note: my chat tableview is interactive e.x. some rows will include image button which need to be pressable, so i cant just put an invisible button onto uitableview.

thank you for your thoughts

Aytunc Isseven

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:38:15+00:00Added an answer on June 4, 2026 at 1:38 pm

    What you want to do is add a gesture recognizer to the UITableView that responds to the appropriate gestures. I would recommend against using UITapGestureRecognizer as the UITableView is already using taps for selecting the cells, so you might want to try the UILongPressGestureRecognizer. I put together a small sample of how you can do this as follows:

    In my viewDidLoad I did the following:

    UILongPressGestureRecognizer *gesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressFrom:)];
    [self.tableView addGestureRecognizer:gesture];
    

    and the handleLongPressFrom: is as follows:

    - (void)handleLongPressFrom:(UILongPressGestureRecognizer *)recognizer {
        NSLog(@"handleLongPressFrom: %@", recognizer);
        // Add real code here
    }
    

    The full list of gestures can be found here.

    Oh, if you did want to still use tap, check out this stack overflow question. I don’t know if the method presented works fully, but it’d be a good place to start.


    Using UITapGestureRecognizer with a UITableView:
    Okay, since the tap gesture seems to be the correct one for your use case you can try and do the following. Step 1 is to set up the gesture recognizer as I listed above using the tap gesture instead of the long press gesture.

    The code in viewDidLoad is very similar with an important addition …

    UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapFrom:)];
    // we need to set the gesture delegate so we can allow the tap to pass through to the
    // UITableViewCell if necessary.
    gesture.delegate = self;
    [self.tableView addGestureRecognizer:gesture];
    

    The handleTapFrom: function is pretty much the same with just the different gesture recognizer as the parameter.

    - (void)handleTapFrom:(UITapGestureRecognizer *)recognizer {
        NSLog(@"handleTapFrom: %@", recognizer);
        // Add real code here
    }
    

    The major changes to this approach is that we need to implement the UIGestureRecognizerDelegate protocol. Since our goal is to allow the tap gesture to pass through the UITableView to it’s subviews (i.e. the UITableViewCell and it’s components) we need to implement the gestureRecognizer:shouldRecieveTouch: function. The following implementation should cover what you are attempting.

    #pragma mark UIGestureRecognizerDelegate methods
    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
        // If the view that is touched is not the view associated with this view's table view, but
        // is one of the sub-views, we should not recognize the touch.
        if (touch.view != self.tableView && [touch.view isDescendantOfView:self.tableView]) {
            return NO;
        }
        return YES;
    }
    

    The isDescendantOfView: function returns YES if the view it is testing against is the same as the view doing the testing, so we need to accommodate that case separately. You can generify this function by using gestureRecognizer.view instead of self.tableView, but I didn’t think it was necessary in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a chat window there are two method one for sending message
Is there any best port for chat programs? I'm making chat and I don't
I am making an application that will work much like a real time chat.
I'm making chat application and read messages data from SQLite database. I want to
I'm making a chat application that works with long-polling to emulate a push from
I'm making a chat responder for a game and i want know if there
Making websites that appear correctly in IE is a big problem. Is there any
I have a pretty complex chat application going on, and there are multiple chat
I am making a network application that has a chat function. On the chat
I am making a chat window, i just want that message and date time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.