• 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: UITextField and UIGestureRecognizers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UITextField and UIGestureRecognizers


  • Subject: Re: UITextField and UIGestureRecognizers
  • From: glenn andreas <email@hidden>
  • Date: Thu, 10 Nov 2011 09:46:43 -0600

On Nov 10, 2011, at 9:41 AM, Matt Neuburg wrote:

> On Mon, 07 Nov 2011 17:32:46 +0100, Olivier Palliere <email@hidden> said:
>> I have a UITextField on a view. I want the user to be able to edit it by single tapping on it, but I want to display a popover to chose from a list when the user does a long press on the UITextfield.
>>
>> To do this, I added a LongPressGestureRecognizer on it and implemented the delegate in my controller.
>>
>> Now it works fine when I start my app, and I do a long press on the UITextfield until I edit it once. When I have edited my field using a single tap, if I try to do again a long press gesture, then my recognizer is ignored, the UITextField enters edit mode and the magnifying glass is shown.
>
> But surely the real problem is that you're doing something you're not supposed to do. A text field already gives a meaning to a long press (selection), and now you're trying to disrupt that.
>
> I recommend you show a menu item instead, which the user can tap to show the list. Or some other alternate interface. *Use* the framework (by letting the framework use you) - don't fight it. m.
>

And it's pretty easy to add a button (or any other UIView) to the UITextField, on either the left or right side, with the option to display when the field is being edited, not being edited, or all the time:

@property(nonatomic,retain) UIView              *leftView;        // e.g. magnifying glass
@property(nonatomic)        UITextFieldViewMode  leftViewMode;    // sets when the left view shows up. default is UITextFieldViewModeNever

@property(nonatomic,retain) UIView              *rightView;       // e.g. bookmarks button
@property(nonatomic)        UITextFieldViewMode  rightViewMode;   // sets when the right view shows up. default is UITextFieldViewModeNever

Seems like putting a button in the rightView that displays when not being edited would work fit with what you described...


Glenn Andreas                      email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL

_______________________________________________

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

  • Follow-Ups:
    • Re: UITextField and UIGestureRecognizers
      • From: Olivier Palliere <email@hidden>
References: 
 >Re: UITextField and UIGestureRecognizers (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Different deployment target for iPhone & iPad
  • Next by Date: Re: Why does changing a UIScrollView's contentInset change contentOffset?
  • Previous by thread: Re: UITextField and UIGestureRecognizers
  • Next by thread: Re: UITextField and UIGestureRecognizers
  • Index(es):
    • Date
    • Thread