HI Guys, 

Yeah I know it sounds like this is against the framework, but I eventually got 
it reading the doc and poking around the web. Basically the UITextField's 
gesture recognizers are reseted to a default value every time it's being 
edited. So you need to setup your own custom recognizer every time the field is 
edited.

All legit, but I agree with you the leftView is an equally good solution and 
probably more obvious.

Thanks!
Olivier./.


On Nov 10, 2011, at 4:46 PM, glenn andreas wrote:

> 
> On Nov 10, 2011, at 9:41 AM, Matt Neuburg wrote:
> 
>> On Mon, 07 Nov 2011 17:32:46 +0100, Olivier Palliere 
>> <oliv...@sunprotectingfactory.com> 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                      gandr...@gandreas.com 
> The most merciful thing in the world ... is the inability of the human mind 
> to correlate all its contents - HPL
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to