以编程方式发送到从接口构建器创建的前/后元素 [英] Programmatically send to front/back elements created from interface builder

查看:94
本文介绍了以编程方式发送到从接口构建器创建的前/后元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在接口生成器中,有布局选项发送回或发送到任何元素,如UIButton,UIImage,UILabel等...

In interface builder, there are layouts options to send to back or send to front any elements such as UIButton, UIImage, UILabel etc...

有没有简单的方法来做呢?

Is there an easy way to do that?

我不想创建不同的视图,只是使用z轴。

I do not want to create different views, just play with the z-axis.

谢谢。

Yohann

推荐答案

UIView 修改视图层次结构。

  • bringSubviewToFront:
  • sendSubviewToBack:
  • insertSubview:atIndex:
  • insertSubview:aboveSubview:
  • insertSubview:belowSubview:
  • exchangeSubviewAtIndex:withSubviewAtIndex:

由于您的视图已经插入到您的超级视图中,因此您可以以任意顺序为每个视图轻松调用 bringSubviewToFront:一次。

Since your views are already inserted into your superview, you could easily call bringSubviewToFront: once for each view in whatever order you like.

这篇关于以编程方式发送到从接口构建器创建的前/后元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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