创建如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).
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcgkhak
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
复制文件夹/文件而不修改属性?
it1352 07-15