• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using protocol extension to dismiss keyboard on outside tap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using protocol extension to dismiss keyboard on outside tap


  • Subject: Re: Using protocol extension to dismiss keyboard on outside tap
  • From: Alex Zavatone <email@hidden>
  • Date: Mon, 18 Apr 2016 16:58:33 -0400

What if you were able to pass in a view that is the containing view that you want to receive the dismiss tap, then add an action to it to call the expected dismiss method?

Hmmm, that won't work if there are other tappable items on the screen though.

I just had this issue too last week, so I'll try to look up the solution when I get home, but I'll admit that my solution sucks.

The bigger issue is that this is a common problem that must have been solved a boatload of times before we ran in to it, yet we don't have a consistent standard for implementing this.

What we really want is a tap on any element that is not the UITextField to dismiss the keyboard, so simply setting the parent view controller to resignFirstResponder is not good enough, because other buttons can eat the tap that you would use for resignFirstResponder.

Here are some questions.

What happens if you wire up a dismiss call that issues a resignFirstResponder to the TouchUp Outside event?

Do we need to rely on a full screen transparent button that sits one layer behind the UITextField that will issue a resignFirstResponser on the text field whenever we have a UITextField that we are editing?

This must have been already solved in an elegant way that we're missing.  What do you think?

Cheers,
Alex Zavatone





On Apr 18, 2016, at 4:07 AM, Devarshi Kulshreshtha wrote:

> Since I have to implement same behavior in multiple view controllers, I am
> trying to identify a way to avoid using repetitive code in multiple classes.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Using protocol extension to dismiss keyboard on outside tap (From: Devarshi Kulshreshtha <email@hidden>)

  • Prev by Date: Re: Getting a double-click on a text label
  • Next by Date: Re: Proper way to set up constants when building an iOS framework
  • Previous by thread: Re: Using protocol extension to dismiss keyboard on outside tap
  • Next by thread: BOOL parameter passed as nil object
  • Index(es):
    • Date
    • Thread