i want to use UIScrollview with one imageview.if i swipe image, next image must be shown.how can i identify horizontal vertical swipe ...how can i detect event?what i have to do in scrollViewDidScroll method.if i add touch event methods, it 开发者_JAVA百科did not work? any help?
i dont want to use PageControl....can i include Touch Event on UIScrollview?
You can use the pagingEnabled
property to support this kind of swiping. You set this property, and the scrollview will scroll horizontally by increments of its own width. So if the scrollview is 480 pixels in width, you just add the views at x locations of 0, 480, 960, etc. and the scrollview will handle the rest for you.
If you need to swap in new images dynamically or want to lazy load them, you can do this by detecting when the scrollview has finished scrolling using the standard delegate methods. Then you just update the adjacent views accordingly.
There is a good sample project provided by Apple here: PageControl
精彩评论