UITextField in UIScrollView
UITextField in UIScrollView
- Subject: UITextField in UIScrollView
- From: Phillip Mills <email@hidden>
- Date: Tue, 14 Dec 2010 15:51:50 -0500
I have a number of UITextField objects inside a (subclass of) UIView, which is the content view for a (subclass of) UIScrollView.
When the user types into a text field, I dynamically change its size if necessary and reset the content size of the content view. When needed, I also scroll so that a rectangle matching the typing position of the active text field is visible in the scroll area. So far, so good.
When the content size is larger than the visible space and the user moves to an empty UITextField to type, the display scrolls right and left on each character. The problem is that scrollRectToVisible:: is being called from a UIFieldEditor object with a rectangle that is the size of the entire content area rather than anything related to the current field or the location where characters are being entered.
Here's a bit of the traceback:
#0 -[MultiLineScrollView scrollRectToVisible:animated:] (self=0x4d2b810, _cmd=0x6cddd5, rect={origin = {x = 0, y = 0}, size = {width = 1119, height = 740}}, animated=1 '\001')
#1 0x0035dd84 in -[UIFieldEditor scrollSelectionToVisible:] ()
#2 0x0035bc18 in -[UIFieldEditor webViewDidChange:] ()
#3 0x0001f6c1 in _nsnote_callback ()
#4 0x00d84f99 in __CFXNotificationPost_old ()
#5 0x00d0433a in _CFXNotificationPostNotification ()
#6 0x00015266 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#7 0x00d1d67d in __invoking___ ()
#8 0x00d1d551 in -[NSInvocation invoke] ()
#9 0x0211982a in SendDelegateMessage ()
#10 0x01f6636f in WebEditorClient::respondToChangedContents ()
#11 0x02166fdc in WebCore::Editor::appliedEditing ()
I suppose I could set up a flag to ignore the call if I've already scrolled the current text field or if the height suggests that it's *not* a text field, but I'm interested in finding a way to handle this that isn't fighting with the framework if at all possible.
(Also, strictly out of curiosity, what are WebCore, WebView, and WebEditorClient things doing in a UITextField?)_______________________________________________
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