UIWebView and CSS fixed position

大城市里の小女人 提交于 2019-12-08 04:41:27

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

This resulted in kind of a knock-off iScroll!

EDIT

Also, you can insert this:

-webkit-overflow-scrolling: touch;

Into the main <div> css for a more native feel.

Unfortunately. position: fixed isn't reliable on iOS yet. This means you'll need to make compromises somewhere.

iScroll may work, but it's a hack at best. Depending on the device it may not scroll fast enough to give that "fixed" look you want.

You haven't given us much detail about what is in this header, but here are a few other possibilities:

a. Place anything you need fixed to the top of the screen in a UIView at the top of your ViewController, with the UIWebView below it.

b. Change your storyboard flow to eliminate the need for a modal segue.

c. Don't use storyboards, thus eliminating the problem with the segue.

d. Redesign your HTML so the need for a fixed header is removed.

Tell us more about what's in this fixed header and maybe we can come up with other ideas.

position: fixed doesn't yet work well on iOS.

iScroll is a safer bet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!