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 7945513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:53:14+00:00 2026-06-04T00:53:14+00:00

i have a custom UIView which is presented from a UIViewController . This view

  • 0

i have a custom UIView which is presented from a UIViewController. This view controller can present one of several such views. One of these views has a UITextView. when one begins entering text in the UITextView, the keyboard is shown. however, I want to dismiss the keyboard whenever the user taps anywhere outside the textview. as multiple UIViews can be presented by the UIViewController based on certain condition, I encapsulated the UITextView delegate methods etc in the custom UIView, I did this using Notifications from within the custom UIView like

- (void)configureView
{ 
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

[nc addObserver:self selector:@selector(keyboardWillShow:) name:
 UIKeyboardWillShowNotification object:nil];

[nc addObserver:self selector:@selector(keyboardWillHide:) name:
 UIKeyboardWillHideNotification object:nil];

self.tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                           action:@selector(didTapAnywhere:)];
}

-(void) keyboardWillShow:(NSNotification *) note {
[self addGestureRecognizer:self.tapRecognizer];
}

-(void) keyboardWillHide:(NSNotification *) note
{
[self removeGestureRecognizer:self.tapRecognizer];
}

-(void)didTapAnywhere: (UITapGestureRecognizer*) recognizer {    
[self.detailsTextView resignFirstResponder];
}

however, when the didTapAnywhere is called, the keyboard does not get dismissed even when the resignfirstresponder ties place. FYI, the delegate for the UITextView is the custom UIView.

ple help in how to do this

  • 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-04T00:53:16+00:00Added an answer on June 4, 2026 at 12:53 am

    Try

    [self.view endEditing:YES];

    instead of resigning the first responder. This should do the trick.
    What’s weird is why isn’t the standard approach working…

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

Sidebar

Related Questions

I have a custom UIViewController, which is the only subView of UIView. The UIViewController
I have a custom UIViewController inited from a nib file with the following view
I have a custom view onto which I draw some graphics from the drawrect
I have a custom UIView which gets loaded through a NIB inside a UIViewController.
I have implemented a custom split view controller which — in principle — works
I have a UIViewController Class which holds 2 custom UIView classes which are: ItemView
I have a custom UIView which is composed of many images, their positions are
I have a custom UIView called TiledImage which has a single property named tiledImage
I have a custom button on a view controller in the navigation controller's heirarchy,
I have a custom UIView , to which I have added a UITapGestureRecognizer to

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.