gpt4 book ai didi

ios - 奇怪的事情: Cannot change UIWebView. origin.x在scrollViewDidEndDecelerating

转载 作者:行者123 更新时间:2023-11-30 13:59:18 25 4
gpt4 key购买 nike

我正在挖掘 UIScrollView 中的无限循环 UIWebView,我尝试用另一个 webview 替换 webview,但失败了。 currWebView.frame.origin.x 无法在scrollViewDidEndDecelerating 中修改。

func scrollViewDidEndDecelerating(scrollView: UIScrollView) {

if endDragOffset > 0 {
// moving forward, get next
if(scrollView.contentOffset.x > mainScrollView!.frame.size.width) {
prevWebView = currWebView // get the content of the next one
currWebView = nextWebView

// set back the position
prevWebView.frame.origin.x = 0
currWebView.frame.origin.x = 320
nextWebView.frame.origin.x = 640

var theNext = getNext(nextVolume, theChapter: nextChapter)
nextVolume = theNext["volume"]!
nextChapter = theNext["chapter"]!
nextChapterArr = getLection(nextVolume, theChapter: nextChapter)
loadPage(nextVolume, theChapter: nextChapter, chapterArr: nextChapterArr, onPage: 2)

print(currWebView.frame.origin.x) // got 640

currWebView.frame.origin.x = 320
print(currWebView.frame.origin.x) // still got 640
}

// moving backward, get previous
if(scrollView.contentOffset.x < mainScrollView!.frame.size.width) {
//.........
}

还有关于在 UISCrollView 中制作无限 webview 的任何其他建议吗?

最佳答案

使用以下代码可以解决问题

let frame = nextWebView.frame
nextWebView.frame = currWebView.frame
currWebView.frame = prevWebView.frame
prevWebView.frame = frame

关于ios - 奇怪的事情: Cannot change UIWebView. origin.x在scrollViewDidEndDecelerating,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33196161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com