2016-11-20 74 views
-2

我在屏幕上有smallButtongiantButtongiantButton在启动时未启用,当smallButton被点击时,它会隐藏并且出现giantButton由另一个按钮覆盖的按钮,因此无法被挖掘

我的问题是,它似乎像smallButtongiantButton覆盖,当我点击smallButton,其IBAction为不会被触发,它在故事板连接好。

是否因为smallButtongiantButton覆盖,还是其他?

+0

你把它们放在彼此之上吗? –

+0

@RashwanL是的,我不能说哪一个正好在最上面 –

+0

你可以隐藏巨大的按钮,当viewLoads和取消隐藏时,按下小按钮反之亦然 – Joe

回答

0

如果您将UIView的任何实例设置为隐藏(或alpha 0),它将不会阻止UI交互。

看看是否禁用userInteractionEnabled帮助你或者你可以override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool在你的子类,并通过通过触摸事件...

0

我看到了问题,这giantButton包含在堆栈视图中,虽然我试图隐藏/禁用giantButton ,这个堆栈视图仍然阻止我的交互。

根据@ der_michael的建议,我禁用了堆栈视图的用户交互,现在它可以工作。

+0

你没有在你的问题中提到堆栈视图 –

+0

@der_michael☺️甚至没有意识到它在那里 –