简体   繁体   English

iOS:纵向/横向网格

[英]iOS: grid in portrait / landscape orientation

I'm building a grid using UIViewTable and adding 4 items for each cel.我正在使用 UIViewTable 构建一个网格,并为每个 cel 添加 4 个项目。

However, when I rotate to portrait, I need to reduce the number of items from 4 to 3. And therefore I recompute the rowsArray and I display again the table.但是,当我旋转到纵向时,我需要将项目数从 4 减少到 3。因此我重新计算 rowsArray 并再次显示表格。

Is this the correct way to proceed?这是正确的方法吗?

thanks谢谢

I advice you to use AQGridView https://github.com/AlanQuatermain/AQGridView我建议你使用 AQGridView https://github.com/AlanQuatermain/AQGridView

It's an open source grid implementation that is simple and that have many samples.这是一个简单的开源网格实现,并且有很多示例。

otherwise, if you add items like described, you will have to redraw all cells content every time the orientation change否则,如果您添加描述的项目,则每次方向更改时都必须重绘所有单元格内容

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

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