简体   繁体   English

如何使两个子视图相互交互?

[英]How to have two subviews interact with each other?

I have a subview layering problem where I have a rotating arrow and a UIButton. 我有一个子视图分层问题,其中有一个旋转的箭头和一个UIButton。 The arrows rotate and the UIButton changes depending on the rotation of the arrows. 箭头旋转,UIButton随箭头旋转而变化。 The problem is that I need to have the UIButton clickable. 问题是我需要让UIButton可点击。 At the moment the arrows rotate but the UIButton is not touchable. 目前,箭头旋转,但UIButton不可触摸。 If I try [self.view sendSubviewToBack:wheelControl]; 如果我尝试[self.view sendSubviewToBack:wheelControl]; the arrows are sent to the back and are no longer visible. 箭头被发送到后面,不再可见。

thanks for any help about how I might fix this. 感谢您提供有关如何解决此问题的帮助。

在此处输入图片说明

You need to call 你需要打电话

[theView bringSubviewToFront:theButton];

as the last call when laying out your subviews. 作为布局子视图时的最后一次调用。

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

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