如何在其他子视图下方插入子视图 [英] How can I insert a subview below the other subviews

查看:88
本文介绍了如何在其他子视图下方插入子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有人.

我在xib文件中绘制了一些标签,并且 使用代码添加背景视图,但是背景视图 在这些标签的前面,所以我看不到它们.所以, 我的问题是如何在这些下方添加背景视图 标签.

I have some labels that I draw them in the xib file, and add a background view using codes,but the background view is in the front of these labels, so I cant see them. So, my question is how can I add a background view below these labels.

谢谢.

推荐答案

如果您使用Google UIView,您将获得文档-

If you Google UIView you'll end up at the documentation - UIView Class Reference

然后,您需要查看方法列表,直到发现听起来像这两个基本满足您的需求的东西:

Then you need to look down the list of methods until you find something that sounds like it will roughly fit your needs like these two:

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index

- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview

这时,您只需要阅读有关方法行为的描述,并选择最容易实现的方法即可.如果您在提出问题之前尝试自己找到答案,对您自己的学习真的很有帮助

At this point you just have to read the descriptions of how the methods behave and pick whichever one is easiest to implement for your design. It's really good for your own learning if you try to find the answer yourself before you ask a question

这篇关于如何在其他子视图下方插入子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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