我在屏幕上有smallButton
和giantButton
,giantButton
在启动时未启用,当smallButton
被点击时,它会隐藏并且出现giantButton
。由另一个按钮覆盖的按钮,因此无法被挖掘
我的问题是,它似乎像smallButton
由giantButton
覆盖,当我点击smallButton
,其IBAction为不会被触发,它在故事板连接好。
是否因为smallButton
被giantButton
覆盖,还是其他?
我在屏幕上有smallButton
和giantButton
,giantButton
在启动时未启用,当smallButton
被点击时,它会隐藏并且出现giantButton
。由另一个按钮覆盖的按钮,因此无法被挖掘
我的问题是,它似乎像smallButton
由giantButton
覆盖,当我点击smallButton
,其IBAction为不会被触发,它在故事板连接好。
是否因为smallButton
被giantButton
覆盖,还是其他?
如果您将UIView的任何实例设置为隐藏(或alpha 0),它将不会阻止UI交互。
看看是否禁用userInteractionEnabled
帮助你或者你可以override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool
在你的子类,并通过通过触摸事件...
我看到了问题,这giantButton
包含在堆栈视图中,虽然我试图隐藏/禁用giantButton
,这个堆栈视图仍然阻止我的交互。
根据@ der_michael的建议,我禁用了堆栈视图的用户交互,现在它可以工作。
你没有在你的问题中提到堆栈视图 –
@der_michael☺️甚至没有意识到它在那里 –
你把它们放在彼此之上吗? –
@RashwanL是的,我不能说哪一个正好在最上面 –
你可以隐藏巨大的按钮,当viewLoads和取消隐藏时,按下小按钮反之亦然 – Joe