Re: Insetting a UIWebView while a keyboard is on screen

2014-05-28 Thread Diederik Meijer | Ten Horses
Keyboard appears in response to a html input element getting focus? If so, 
adding a javascript scrollTo may work. When the element gets focus, calculate 
its y position in the webview and call scrollTo with relevant coordinates. 
Maybe all in javascript, which makes it fast and lightwight. Do you own the 
html? 

Verstuurd vanaf mijn iPhone

> Op 29 mei 2014 om 00:27 heeft Nick Zitzmann  het 
> volgende geschreven:
> 
> 
>> On May 28, 2014, at 2:11 AM, Diederik Meijer  wrote:
>> 
>> You could consider animating the UiWebview up when the keyboard appears and 
>> down again when it disappears.
> 
> That works, but then I have the opposite problem - touching in an area that 
> isn't obscured by the keyboard causes it to be moved off the top of the 
> screen. So I tried using UIGestureRecognizer to figure out where the user 
> touched the screen, but UIGestureRecognizers added to UIWebViews don't seem 
> to be called when the view is touched.
> 
> So how do I figure out where the user touched the view so the app can know 
> when not to move the view? The AppKit has the -[NSApplication currentEvent] 
> property, but I can't find any UIKit equivalent.
> 
> Nick Zitzmann
> 
> 
> 
> 
> 

___

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

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

Re: Insetting a UIWebView while a keyboard is on screen

2014-05-28 Thread Nick Zitzmann

On May 28, 2014, at 2:11 AM, Diederik Meijer  wrote:

> You could consider animating the UiWebview up when the keyboard appears and 
> down again when it disappears. 

That works, but then I have the opposite problem - touching in an area that 
isn't obscured by the keyboard causes it to be moved off the top of the screen. 
So I tried using UIGestureRecognizer to figure out where the user touched the 
screen, but UIGestureRecognizers added to UIWebViews don't seem to be called 
when the view is touched.

So how do I figure out where the user touched the view so the app can know when 
not to move the view? The AppKit has the -[NSApplication currentEvent] 
property, but I can't find any UIKit equivalent.

Nick Zitzmann





___

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

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

Re: Insetting a UIWebView while a keyboard is on screen

2014-05-28 Thread Diederik Meijer
You could consider animating the UiWebview up when the keyboard appears and 
down again when it disappears. 

Verstuurd vanaf mijn iPad

> Op 28 mei 2014 om 05:40 heeft Nick Zitzmann  het 
> volgende geschreven:
> 
> Short question: What's the best way to scroll a UIWebView slightly from its 
> current position when there's a keyboard present? I already tried 
> -[UIScrollView setContentInset:], but that does not work when a keyboard is 
> on screen.
> 
> Long question:
> 
> I have a UIWebView, and I'm trying to graft a custom keyboard extension onto 
> it that will appear on top of the keyboard. Since UIWebView doesn't support 
> -inputAccessoryView, I've made this happen by listening for 
> UIKeyboardWillShowNotification, and then adding the extension view as a 
> subview when the notification is received.
> 
> This works fine, except that the spot the user is editing might appear 
> underneath the keyboard extension, so I need to inset the scroll view in 
> order to compensate for this or the user won't be able to see what they are 
> editing. So I tried adjusting the scroll view's content inset, but I noticed 
> that UIWebView makes its own adjustment to the content inset whenever the 
> keyboard appears, and the attempt to change it twice in a row seems to cause 
> the content inset to change to some other number internally for some reason. 
> So how do I move the scroll view slightly if adjusting the content inset 
> won't work?
> 
> Nick Zitzmann
> 
> 
> 
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com

___

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

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

Insetting a UIWebView while a keyboard is on screen

2014-05-27 Thread Nick Zitzmann
Short question: What's the best way to scroll a UIWebView slightly from its 
current position when there's a keyboard present? I already tried 
-[UIScrollView setContentInset:], but that does not work when a keyboard is on 
screen.

Long question:

I have a UIWebView, and I'm trying to graft a custom keyboard extension onto it 
that will appear on top of the keyboard. Since UIWebView doesn't support 
-inputAccessoryView, I've made this happen by listening for 
UIKeyboardWillShowNotification, and then adding the extension view as a subview 
when the notification is received.

This works fine, except that the spot the user is editing might appear 
underneath the keyboard extension, so I need to inset the scroll view in order 
to compensate for this or the user won't be able to see what they are editing. 
So I tried adjusting the scroll view's content inset, but I noticed that 
UIWebView makes its own adjustment to the content inset whenever the keyboard 
appears, and the attempt to change it twice in a row seems to cause the content 
inset to change to some other number internally for some reason. So how do I 
move the scroll view slightly if adjusting the content inset won't work?

Nick Zitzmann





___

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

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