开发者

Horizontal scrolling for UITableView

开发者 https://www.devze.com 2023-02-02 10:38 出处:网络
I am creating a studying system that needs to swipe between N tables (ie 25 separate static tableviews each comprising of a question, options 1 - 4, an answer and an explanation). Does anyone know the

I am creating a studying system that needs to swipe between N tables (ie 25 separate static tableviews each comprising of a question, options 1 - 4, an answer and an explanation). Does anyone know the best way to tackle this. Has anyone seen sample code which can help me out?

I understand that such a scroll behavior goes against best practices for UITableviews as this is reserved for deleting but we do not require deleting in our app and thus there is no 开发者_如何学JAVAconflict.

Thanks!


If you want the user to be able to slide easily between all the table views both forwards and backwards, use a UIScrollView with pagingEnabled set to YES.

Just set the width of the scroll view to the size of the app. Set the content size to be 25 times wider than that. Add each tableView next to each other inside the scroll view and UIKit should handle the scrolling and stopping at the right place for you.

However, if the user has to answer each question in turn, use a UINavigationController, loading the next UITableViewController when the previous question has been answered.

0

精彩评论

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

关注公众号