iphone: View on top of UIWebView?

前端 未结 4 1174
-上瘾入骨i
-上瘾入骨i 2021-02-04 15:35

I\'m working on a browser app, and I have an address bar on top the UIWebView. On MobileSafari if you scroll down, the address bar starts to move to the top, out of the screen,

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 16:20

    PeakJi's solution works but is a bit laggy. A better solution would be adding an observer to the UIScrollView's content offset, something like

    [scrollview addObserver:self forKeyPath:@"contentOffset" 
                                        options:NSKeyValueObservingOptionNew context:nil];
    

    You can find more document on NSKeyValueObserving protocol at

    https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html

提交回复
热议问题