I have UIView
and UIWebView
on screen. When I click on text field in website, web view content is going up. How could I force UIView
to move as well then?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
You can subscribe to either the
UIKeyboardWillShowNotification
or theUIKeyboardDidShowNotification
, and move yourUIView
when you receive the notification. This process is described here:Text, Web, and Editing Programming Guide for iOS: “Moving Content That Is Located Under the Keyboard”
Wow, I had the same problem few days ago, it was really annoying. I figured out that
window.yPageOffset
is changing, but as far as I know there aren't any events to bind when it changes. But maybe it will help you somehow. ;-)Maybe this helps: I didn't want the UIWebView to scroll at all, including when focusing on a textfield.
You have to be the delegate of the UIWebView:
And then add this method
I think you overwrote
scrollViewDidScroll
wrong. You need to implement custom class forUIWevView
and overwritescrollViewDidScroll
:UIWebView has a callback:
This is triggered whenever a new URL request is about to load. From javascript, you could trigger a new request URL on the onfocus event of the tag, with a custom schema like:
Here's a script to put your custom event inside any html page to load.
You'll have to get the whole HTML before loading it to the UIWebView like this:
Then insert the following inside the HTML text in a appropriate place:
Then, on the callback you should do something like this:
That's it. Hope it helps.