在我的应用程序中,我有一个scrollView,其中包含几个webview(我只使用3个webViews做无限滚动)...为了做到这一点,我需要切换2个Web视图的内容(类似于复制一个webview到另一个可能吗?)...只能将htmlString从一个webView加载到另一个...
任何想法?非常感谢提前
编辑:代码与本教程非常相似:http://mobiledevelopertips.com/user-interface/creating-circular-and-infinite-uiscrollviews.html
答案 0 :(得分:0)
如果有人关心我只是通过将uiwebvies添加到一个可变数组中然后首先在滚动视图(visibily)中切换它们然后在那个可变数组(逻辑上)中切换它们来解决它。在上面的链接示例中,代码看起来像“向右滚动”(在scrollViewDidEndDecelerating :):
CGRect frame = ((UIView*)[self.arrWebViewsContent objectAtIndex:2]).frame;
((UIView*)[self.arrWebViewsContent objectAtIndex:2]).frame = ((UIView*)[self.arrWebViewsContent objectAtIndex:1]).frame;
((UIView*)[self.arrWebViewsContent objectAtIndex:1]).frame = ((UIView*)[self.arrWebViewsContent objectAtIndex:0]).frame;
((UIView*)[self.arrWebViewsContent objectAtIndex:0]).frame = frame;
UIView *view_tmp = [self.arrWebViewsContent objectAtIndex:0];
[self.arrWebViewsContent replaceObjectAtIndex:0 withObject:[self.arrWebViewsContent objectAtIndex:1]];
[self.arrWebViewsContent replaceObjectAtIndex:1 withObject:[self.arrWebViewsContent objectAtIndex:2]];
[self.arrWebViewsContent replaceObjectAtIndex:2 withObject:view_tmp];