The only way to implement this requires iOS 5. In iOS 5, the UIWebView has a subheading called UIScrollView.
And use the following code:
Set the address bar area:
[[myWebView scrollView] setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
Move the address bar using the scrollview delegate:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ if(scrollView.contentOffset.y>=-64&&scrollView.contentOffset.y<30) { topBar.frame=CGRectMake(0,-44-scrollView.contentOffset.y, 320, 44); } else if(scrollView.contentOffset.y<-64) topBar.frame=CGRectMake(0,20, 320, 44);
Peakji
source share