开发者

How to add another page to an UIScrollView by swiping?

I am a french 17 years old guy so excuse my english.

I am creating an app' using an UIScrollView with an UIPageControl to display multiple UIView pages from UIViewControllers (which display an object) . Everything works pretty great.

Now i wo开发者_C百科uld like to add a new page (and a new empty object but that is not a problem) when I swipe the UIScrollView to the right in the last view.

How could I do that ? And if it's not possible, how can I update the UIScrollView ?

Thank you very much !


I think you need to keep an eye on two things. scrollViewDidScroll: & UIPageControl's currentPage. When you determine that the user is currently viewing the rightmost page & the UIScrollView was scrolled, you can add a new page to the UIPageControl. The amount by which the scroll view was scrolled is related to scrollView.contentOffset.x. A new page can be added to the page control by incrementing its numberOfPages & setting the currentPage to the newest page.

HTH,

Akshay


This is what you are looking for I think : a sample code from Apple to build a photo viewer that load images just before they appear on screen.

https://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010080

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜