0
Je creuse sur UIWebViews boucle infinie qui sont dans un UIScrollView, et j'ai essayé de remplacer le webview avec un autre, mais a échoué. Le fichier currWebView.frame.origin.x ne peut pas être modifié dans scrollViewDidEndDecelerating.Chose étrange: Impossible de changer UIWebView.origin.x dans 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) {
//.........
}
et toute autre suggestion sur la création d'un affichage Web infini dans UISCrollView?