将先前添加的视图置于最前面 [英] Bring previously added view to front

查看:163
本文介绍了将先前添加的视图置于最前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题如下:

我有一个视图,并向该视图中依次添加了3个subViews(view1view2view3).视图略有重叠.我想将第一个视图显示在顶部,但我无法使其正常工作.

I have a view and to that view I add 3 subViews(view1,view2,view3) in that order. The views slightly overlap. I want to bring the first view to the top but I just can't get it to work.

我尝试使用insertSubview:atIndex:添加视图并为view1提供更大的索引,然后尝试使用addSubview:然后再带SubSubviewToTop,但似乎没有任何作用.

I tried adding the views with insertSubview:atIndex: and giving view1 a larger index and I tried using addSubview: and then bringSubviewToTop but nothing seems to work.

有什么想法吗?

P.S.我不能以其他顺序添加视图.必须按此顺序添加它们.

P.S. I can't add the views in a different order. They have to be added in this order.

推荐答案

bringSubviewToFront应该可以工作,只需确保正确使用即可.用法是.

bringSubviewToFront should work, just make sure you're using it correctly. The usage is.

[parentView bringSubviewToFront:view1];

这篇关于将先前添加的视图置于最前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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