如何创建如iPhone主屏幕的图标网格? [英] How do I create a grid of icons like the iPhone home screen?

查看:534
本文介绍了如何创建如iPhone主屏幕的图标网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在iPhone上创建类似于Springboard(主屏幕)的UI?我想要一个网格的均匀间隔的按钮,其中我可以响应按钮点击。

How should I go about creating a UI similar to the Springboard (home screen) on the iPhone? I'd like a grid of evenly spaced buttons with images where I can respond to the button tap.

UITable是否适合?我应该使用一个简单的UIView并在DrawRect中手动定位图标?有没有可以自动均匀分布按钮,允许重新组织,并根据iPhone方向调整布局的替代方法?

Is the UITable a good fit? Should I use a plain UIView and position the icons manually in DrawRect? Is there an alternative that will automatically evenly space the buttons, allow reorganization, and adjust the layout according to the iPhone orientation?

我来自一个C#/ Winforms背景和

I come from a C#/Winforms background and am just now starting iPhone development on the Open Toolchain with 2.2.1 headers.

推荐答案

您需要添加您的图标(这是UIViews作为你的跳板视图的子视图。不需要自定义绘图,UITable是绝对错误的方式去。你只需要做正确的数学(通过设置他们的框架)。

You need to add your icons (which are UIViews of some sort) as subviews of your "Springboard" view. No custom drawing needed, and a UITable is thh absolute wrong way to go. You just need to do the math to place them correctly (by setting their frame).

这篇关于如何创建如iPhone主屏幕的图标网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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