简体   繁体   English

如何分组ui元素ios

[英]how to group ui elements ios

I'm looking for a way to group some ui elements together just like the twitter app does but I can't find anything which suits my needs. 我正在寻找一种方法将一些ui元素组合在一起,就像twitter应用程序一样,但我找不到任何适合我需要的东西。

equivalent to jpanel in java or groupbox in .net 相当于java中的jpanel或.net中的groupbox

this is what I'm talking about: http://i46.tinypic.com/169etxi.jpg 这就是我所说的: http//i46.tinypic.com/169etxi.jpg

On interface builder, you can embed ui elements in a view or scrollview. 在界面构建器上,您可以在视图或滚动视图中嵌入ui元素。 Just select all the elements you want to group and then click Editor -> Embed In -> View/Scrollview 只需选择要分组的所有元素,然后单击编辑器 - >嵌入 - >查看/滚动查看

Grouping UI elements in UIKit is as simple as putting child views into a parent UIView . 在UIKit中对UI元素进行分组就像将子视图放入父UIView一样简单。 Just use the addSubview: method. 只需使用addSubview:方法即可。

From the docs: 来自文档:

Views can embed other views and create sophisticated visual hierarchies. 视图可以嵌入其他视图并创建复杂的可视层次结构。 This creates a parent-child relationship between the view being embedded (known as the subview) and the parent view doing the embedding (known as the superview). 这将在嵌入的视图(称为子视图)和执行嵌入的父视图(称为超级视图)之间创建父子关系。

Here are the docs: 以下是文档:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html

One, not so neat, solution is to create an image and use it as the background and put the ui elements on top of it. 一个,不是那么整洁,解决方案是创建一个图像并将其用作背景并将ui元素放在它上面。 Here is the image I used(retina). 这是我使用的图像(视网膜)。 http://tinypic.com/r/6i9m3b/6 http://tinypic.com/r/6i9m3b/6

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

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