I am using a UIScrollView that has large images and paging to scroll between the images. To save memory, I am loading only one image after the first person is seen and after the completion of a scroll and after loading / releasing new images. The problem occurs when a scroll is not called quickly and scrollViewDidEndDecelerating. When called scrollViewDidEndDecelerating I wanted to display the image name in the active page.
How do I solve this? Why does this happen
im just looking at a scroll - the lazy load of images Used to be. We actually load a thumbnail that is drawn (making a blurry low race version of the image) and then load the actual image when the page is actually being 100% in view.
What I had to do was use the following code in scrollViewDidScroll: scrollview
- (zero) scrollViewDidScroll:. (UIScrollView *) scrollview {if (! _isCurrentlyRotating) {CGFloat pageWidth = _scrollView.frame.size.width; Int page = floor ((_ scrollView.contentOffset.x - PageWidth / 2) / PageWidth) +1; If (_currentPage! = Page) [Self Set Us: Page: Page]; }} Calculates the page above that is going to be displayed (as your scrolling) when the page view will display 50% it will actually replace the current page number. This current page can be used in conjunction with page control to highlight dot.
Using the above version, when the user uses his finger to change the page (normal (with the paging enabled on scrolling view) behavior) scrollViewDidEndDecelerating: when the page is displayed 100% So the scrollView is called 100%, I mean you can not see only part of a part of a page another
But we call the end of the book scene that more than a 'start over my scrollToPage 'Button: .. Function - Scroll to (zero) page: (int) page {CGRect frame; Frame.origin.x = self.scrollView.frame.size.width * Page; Frame.origin.y = 0; Frame.Size = self.scrollView.frame.size; [Self.scrollView scrollRectToVisible: animated frame: yes]; ScrollRectToVisible: The scrollViewDidEndDecelerating is not triggered by using the animated method: Method so that I simply add the sharpening method (which only loads the image high in the image view, it loads high reserve), call it both ways that it will be called if the user scrolls Or if the start button is pressed. - (zero) scrollViewDidEndScrollingAnimation: (UIScrollView *) scrollView {[self sharpenImageView]; } - (zero) scrollViewDidEndDecelerating: (UIScrollView *) scrollView {[self sharp image view]; } I hope it helps!
Comments
Post a Comment