在 Cocoa(或者一般的 GUI 开发)中,如何指定任意数量的平铺在一起的事物?
我是创建 GUI 的新手,到目前为止我所做的一切都是使用命令行。
作为一个实验,我正在尝试创建一个到 Macintosh 的扫雷游戏端口,并且我已经让 CLI 工作了,但是我在使用 GUI 时到处都碰壁了。然而,我要做的第一件事就是能够为网格平铺 nxm 个“盒子”——而且我不知道该怎么做。信息已经准备好交给它,但我不知道在哪里做,或者如何做。
另外,如果有人对网站/Cocoa 开发书籍有任何建议,请随时将它们放在这里......
谢谢!
I'm new to creating GUI's, everything I've done up until this point is using the command line.
I'm trying to create a port of minesweeper to the macintosh, as an experiment, and I've got the CLI working, but I'm running into walls everywhere with the gui. The first thing it seems I have to do, however, is be able to tile n x m 'boxes' for grid - and I'm not sure how to do that. The information is ready to be handed to it, but I don't know where to do it, or how.
Also, if anyone has any recommendations for sites/Cocoa development books, feel free to drop them in here...
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,您应该使用为您提供网格布局的控件。 Cocoa 给你两个选择:
NSMatrix
,对NSCell
实例进行分组NSCollectionView
,对NSView
实例进行分组 (OSX >= 10.5)In general you should go with controls that give you a grid layout. Cocoa gives you two choices:
NSMatrix
, groupingNSCell
instancesNSCollectionView
, groupingNSView
instances (OSX >= 10.5)