iOS中的网格视图 [英] Grid view in iOS

查看:90
本文介绍了iOS中的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPhone应用程序中创建类似于 iPad照片所示的网格视图.应用.是否存在可用于添加此类功能(非SDK)的库或框架?理想情况下,我希望最终开发一个iPad版本的应用程序,该网格的纵向宽度为3个项目,横向为4个项目,但是暂时我希望纵向宽度为2个项目,横向为3个项目.

我想到的唯一方法是子类化UITableView并创建一个创建2或3个项目的自定义单元格.但是,这似乎很混乱,我相信有更好的方法.

一个典型的物品将带有图片,标签和按钮-没什么复杂的.

解决方案

您仍然可以为此使用UITableView,而无需对其进行子类化.就像您说的那样,您要做的就是创建自己的自定义单元,这并不复杂.一点也不乱:)

I would like to create a grid view in my iPhone app similar to that shown in the iPad photos app. Is there a library or framework available for adding this kind of functionality (non-SDK)? Ideally I would like to eventually develop an iPad version of the app, where the grid would be 3 items wide in portrait and 4 in landscape, however for the time being I would like 2 items wide in portrait and 3 wide in landscape.

The only way I can think of doing this is by subclassing UITableView and having a custom cell that creates the 2 or 3 items. This however seems messy and I am sure that there is a better way.

A typical item will have a picture, label and button - nothing too complicated.

解决方案

You can still use the UITableView for this and you would not need to subclass it. Like you said all you have to do is create your own custom cell which it is not complicated. Not messy at all :)

这篇关于iOS中的网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆