简体   繁体   中英

How to implement swipe views with CollectionView/TableView Controllers?

I am creating an app using Swift, and I'm still trying to figure out what the best configuration would be. What I'd like to have is 3 screens (the left screen would have a side out panel) that users can access via the navigation bar menu or just by swiping left/right the screen for more accessibility.

I could easily create my TableViewControllers/CollectionViewController and the menu, but I'm struggling at making the screen able to detect users gestures at the same time, and I'm not sure whether I should use 3 View Controllers and then add the Collection View/Table View via the Storyboard, or directly use the CollectionViewController/TableViewController

I added a picture here describing what I'd like to accomplish:

我想要完成的草案

Also, I wonder whether I should use storyboards or not for my project.

I know that's a lot of questions !

Any ideas please ?

Thank you very much and have a good day,

J.

您可以使用scrollview作为容器,在其中放入三个ViewController。

You need to add 2 "swipe gesture recogniser"s to your middle screen(your second screen in your attached image) , and set one for identifying left swipe and another for right swipe. Create action methods for both in your view controller and add code accessing left screen and right screen in respective methods.

note - you need to drag "swipe gesture recogniser" to top bar of your view controller scene to add it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM