UIWebView under transparent UINavigationBar

前端 未结 6 1102
醉酒成梦
醉酒成梦 2021-02-09 21:30

I have a UIWebView which I want to put under my translucent UINavigationBar. Normally when I put a UIScrollView under a translucent UINavigationBar, I set its contentOffset such

6条回答
  •  不思量自难忘°
    2021-02-09 22:30

    I am not sure if there is a clean method to doing this. I have not tried it, but here is an idea:

    1. draw the uiwebview at origin 0,0
    2. intercept all screen touches
    3. if you detect the user dragging up (scrolling up the webview), dont pass the touch on
    4. Instead, move the webview up x pixels so its origin is (0,-x). Then change the height to add x pixels
    5. Youy will need to keep some sort of state so that you know when to stop resizing the webview and start passing on the touches so the webview will scroll.

    Getting it back is the same only you do it on a drag down (scrolling down the webview).

提交回复
热议问题