UIWebView and CSS Fixed Position

I have UIWebViewone that uses a fixed position header.

When the ViewControllercontaining UIWebViewone is the initial view, there is no problem with fixed div positions.

When I show the same ViewControllerthrough Modal segue, when a problem occurs.

The first time I look at a page, divs move and scroll with the page, but as soon as I release the scroll for the first time, the div will return to a fixed position and the error will never be repeated.

Any ideas? I saw iScrollit doesn’t work as if I also want this page, and I think it’s easier there, since I only get the problem on boot UIWebView...

+1
source share
3 answers

I used the CSS workaround, positioning the title as absolute in the upper left corner and giving the main <div>a overflow-y: scroll;and saving body { height: 100%; }.

This led to an iScroll bounce!

EDIT

Alternatively, you can insert this:

-webkit-overflow-scrolling: touch;

In basic <div>css for a more natural feel.

+4
source

Unfortunately. position: fixednot yet reliable on iOS. That means you have to compromise somewhere.

iScroll may work, but at best it’s a hack. Depending on the device, it may not scroll fast enough to provide the desired “fixed” look.

, , :

. , , UIView ViewController, UIWebView .

. , .

. , segue.

. HTML-, .

, , , , .

+3

position: fixed not working well on iOS yet.

iScroll is a safer bet.

0
source

All Articles