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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:13:55+00:00 2026-06-18T00:13:55+00:00

I have a board (UIViewController) which instantiates card objects (UIViewControllers). On each card there’s

  • 0

I have a board (UIViewController) which instantiates card objects (UIViewControllers). On each card there’s a texfield. In order to remove the keyboard by clicking on the non card area (= view of the board) I need a reference to the board specified in the UITapGestureRecognizer. Here’s my current approach.

Board (UIViewController) Initializing a card object

-(void) addCard:(id)touchEvent{
    CardViewController *card = [[CardViewController alloc]initItemWithText:@"..."];
    [self addChildViewController:card];
    [self.view addSubview:card.view];
}

Card (UIViewController) On init, add Tap Gesture Recognizer

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
...
    UITapGestureRecognizer *tapBackground = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapBackground:)];
    [self.parentViewController.view addGestureRecognizer:tapBackground];
...
}

The “background” reference using the parentViewController method doesn’t seem to work. Why?

How can I reference from the card back to the board to resign the card’s first responder on tap?

  • 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-18T00:13:56+00:00Added an answer on June 18, 2026 at 12:13 am

    Try add the gesture code to Board instead of Card (in viewDidLoad)

    UITapGestureRecognizer *tapBackground = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapBackground:)];
    [self.view addGestureRecognizer:tapBackground];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is the task: I have a board of Lights, numbered 0,1,2,...,1023. Each Light
I have a SurfaceView where I'm drawing a matrix (game board) and each cell
So, I currently have a Board class that is composed of Piece s. Each
I have a bluetooth board in an electronic device which I know the mac
I'm making a Tic-tac-toe game and i have a board class which contains 9
I'm implementing a card game. In this game I have a Board that is
I am writting a program in which i have a board (3 x 3
As it is right now I have a Board object which contains an 8x8
I have a board with an ATMEGA88 chip which has a bootloader at address
I have a story board with a UIViewController. The viewController has many views In

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.