简体   繁体   English

在iOS中水平分割UITableview?

[英]Split UITableview horizontally in IOS?

I have a SQLite project in IOS for Ipad. 我在IOS的Ipad中有一个SQLite项目。 the database contains one table with a lot of products. 该数据库包含一个包含许多产品的表。 what I want to do is separate this products into categories. 我要做的是将此产品分为几类。 so that i can make a separate tableview for each category. 这样我就可以为每个类别创建单独的tableview。 So my question is, can I use one table view with different sections, but put this sections side by side horizontally? 所以我的问题是,我可以使用一个带有不同部分的表格视图,但可以水平并排放置这些部分吗? The application only work on landscape mode. 该应用程序仅在横向模式下工作。 I hope the question is clearly enough. 我希望这个问题足够清楚。 Thank's. 谢谢。

在此处输入图片说明

You can achieve this using a UICollection view (iOS6+ only, but there is an open source back-port here ), or you can roll your own using scroll views. 你可以做到这一点使用UICollection视图(iOS6的唯一+,但有一个开源的背面端口位置 ),或者你可以滚你自己使用滚动的观点。

The collection view scrolls horizontally, and has a number of items matching the sections in your catalogue. 集合视图水平滚动,并且有许多与目录中各部分匹配的项目。

Each cell of the collection view contains a header and a table view, holding the detail from the appropriate section. 收集视图的每个单元格都包含一个标题和一个表视图,其中包含相应部分的详细信息。

Use child view controllers to keep your code clean - the view for each cell should be managed by its own view controller, which doesn't need to know it is in a collection view cell. 使用子视图控制器来保持您的代码干净-每个单元格的视图应由其自己的视图控制器管理,而不必知道它在集合视图单元格中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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