在我的应用程序中,我有webview和webview上方的一些项目。当我滚动webview时我想滚动这些项目。我尝试了很多东西,这是不可能在scrollViewDidScroll.i需要别的东西。我试过这些代码但它效率不高..
- (void)scrollViewDidScroll:(UIScrollView *)sender {
CGRect webViewFrame = self.contentWebView.frame;
webViewFrame.origin.y -= 3;
CGRect imageViewFrame = self.featuredImageView.frame;
imageViewFrame.origin.y -= 3;
CGRect overlayFrame = self.overlayView.frame;
overlayFrame.origin.y -= 3;
[UIView animateWithDuration:0.001 animations:^{
self.contentWebView.frame = webViewFrame;
self.featuredImageView.frame = imageViewFrame;
self.overlayView.frame = overlayFrame;
}completion:^(BOOL finished) {
CGPoint offset2 = sender.contentOffset;
offset2.y = 0;
sender.contentOffset = offset2;
}];
}
答案 0 :(得分:0)
尝试将subView(其他项目)添加到webView.scrollView;)
示例:[myWebView.scrollView addSubView:myItem];